[Ssh-sftp-perl-users] NET::SFTP problem with RSA key
Brought to you by:
dbrobins
|
From: Alessandro De M. <ale...@tr...> - 2007-06-05 12:31:02
|
Hi all,
I beg your help for a problem I have trying to use the Net::SFTP module.
I'm trying to create a script that will move files using an sftp
connection.
I will have to use just the publickey authentication.
I have written a little script just to connect and make sure I can
simply put a file there, just as a test, but even if the "password"
authentication works, I can't have the publickey to get into action.
here the script
##########################################################
#!/usr/bin/perl -w
use Net::SFTP;
$sftp_server = "my_server";
@keys = ("/home/myuser/.ssh/id_rsa");
my $sftp = Net::SFTP->new($sftp_server, (
user => 'myuser',
debug =>3,
protocol =>'2,1',
options=>["IdentityFile ~/.ssh/id_rsa"]
));
I have tried a NUMBER of combination, even passin the \@keys or having
identity_files => ["~/.ssh/id_rsa"].
I have also copied "id_rsa" to "identity" and removed the IdentityFile
to have the key to be picked up as default.
####################
and I have even tried just the use Net::SSH::Perl module:
my $ssh = Net::SSH::Perl->new($sftp_server, debug =>'3',
identity_files => ["~/.ssh/id_rsa"] );
$ssh->login('myuser');
my($stdout, $stderr, $exit) = $ssh->cmd('ls');
print $stdout;
Running on fedora 6. perl, v5.8.8
modules installed through cpan.
Module = Net::SFTP (DBROBINS/Net-SFTP-0.10.tar.gz)
#### in case you wonder:
[myuser@laptop10 .ssh]$ ls -l
total 36
-rw------- 1 myuser myuser 440 Jun 4 17:06 authorized_keys
-rw------- 1 myuser myuser 1679 May 14 14:07 id_rsa
-rw-r--r-- 1 myuser myuser 411 May 14 14:07 id_rsa.pub
-rw-r--r-- 1 myuser myuser 6813 May 25 16:03 known_hosts
-rw-rw-r-- 1 myuser myuser 1192 Jun 5 11:08 known_hosts2
#### I can also successfully ssh to the server above using my id_rsa
key:
[myuser@laptop10 ~]$ ssh my_server
Last login: Tue Jun 5 11:22:25 2007 from 217.207.105.92
Access for authorised personnel only
[myuser@my_server myuser]$
here is the debug I get:
#######################################################
laptop10.tradocs.net: Reading configuration
data /home/myuser/.ssh/config
laptop10.tradocs.net: Reading configuration data /etc/ssh_config
laptop10.tradocs.net: Connecting to wb2, port 22.
laptop10.tradocs.net: Remote version string: SSH-2.0-OpenSSH_3.6.1p2
laptop10.tradocs.net: Remote protocol version 2.0, remote software
version OpenSSH_3.6.1p2
laptop10.tradocs.net: Net::SSH::Perl Version 1.30, protocol version 2.0.
laptop10.tradocs.net: No compat match: OpenSSH_3.6.1p2.
laptop10.tradocs.net: Connection established.
laptop10.tradocs.net: Sent key-exchange init (KEXINIT), wait response.
laptop10.tradocs.net: Algorithms, c->s: 3des-cbc hmac-sha1 none
laptop10.tradocs.net: Algorithms, s->c: 3des-cbc hmac-sha1 none
laptop10.tradocs.net: Entering Diffie-Hellman Group 1 key exchange.
laptop10.tradocs.net: Sent DH public key, waiting for reply.
laptop10.tradocs.net: Received host key, type 'ssh-dss'.
laptop10.tradocs.net: Host 'wb2' is known and matches the host key.
laptop10.tradocs.net: Computing shared secret key.
laptop10.tradocs.net: Verifying server signature.
laptop10.tradocs.net: Waiting for NEWKEYS message.
laptop10.tradocs.net: Enabling incoming encryption/MAC/compression.
laptop10.tradocs.net: Send NEWKEYS, enable outgoing
encryption/MAC/compression.
laptop10.tradocs.net: Sending request for user-authentication service.
laptop10.tradocs.net: Service accepted: ssh-userauth.
laptop10.tradocs.net: Trying empty user-authentication request.
laptop10.tradocs.net: Authentication methods that can continue:
publickey,password,keyboard-interactive.
laptop10.tradocs.net: Next method to try is publickey.
laptop10.tradocs.net: Next method to try is password.
laptop10.tradocs.net: Trying password authentication.
laptop10.tradocs.net: Authentication methods that can continue:
publickey,password,keyboard-interactive.
laptop10.tradocs.net: Next method to try is publickey.
laptop10.tradocs.net: Next method to try is password.
laptop10.tradocs.net: Trying password authentication.
laptop10.tradocs.net: Authentication methods that can continue:
publickey,password,keyboard-interactive.
laptop10.tradocs.net: Next method to try is publickey.
laptop10.tradocs.net: Next method to try is password.
laptop10.tradocs.net: Trying password authentication.
laptop10.tradocs.net: Authentication methods that can continue:
publickey,password,keyboard-interactive.
laptop10.tradocs.net: Next method to try is publickey.
laptop10.tradocs.net: Next method to try is password.
Could you please help me in identifying what am I doing wrong?
Regards
Alex
|