Re: [Ssh-sftp-perl-users] Fwd: How to load my private DSA key for authentication?
Brought to you by:
dbrobins
From: Anthony L. <ant...@ya...> - 2012-02-13 18:59:40
|
I wasn't aware this cpan utility, much like apt-get. So, I have installed Net::SFTP::Foreign 1.69. Confirmed with your script: C:\PerlTests>perl ./fandino.pl This is Net::SFTP::Foreign 1.69 running on perl v5.12.3 on MSWin32 Now, if I run the following code to try to connect to my ssh server: use Net::SFTP::Foreign 1.69; $host = "my.ssh.server.com"; $port = 22; $user = "aliu"; $publickey="id_dsa.pub"; $privatekey = "id_dsa"; $sshcmd = "plink.exe"; %args = ("port", $port, "key_path", $privatekey, "user", $user, "ssh_cmd", $sshcmd); my $sftp = Net::SFTP::Foreign->new(host=>$host, %args); if ($sftp->error) { my ( $code, $error_name, $error_message ) = $sftp->error; print "sftp error[$code] $error_name: $error_message \n"; } else { print "Success!"; } I get this: C:\PerlTests>perl ./test.pl The server's host key is not cached in the registry. You have no guarantee that the server is the computer you think it is. The server's rsa2 key fingerprint is: ssh-rsa 2048 3c:3c:ad:17:98:88:c5:1d:95:9e:1b:d6:4e:05:b0:a9 If you trust this host, enter "y" to add the key to PuTTY's cache and carry on connecting. If you want to carry on connecting just once, without adding the key to the cache, enter "n". If you do not trust this host, press Return to abandon the connection. Store key in cache? (y/n) Connection abandoned. sftp error[Connection to remote server is broken] : C:\PerlTests> ________________________________ From: Salvador Fandino <sfa...@ya...> To: Anthony Liu <ant...@ya...> Sent: Monday, February 13, 2012 1:25 PM Subject: Re: [Ssh-sftp-perl-users] Fwd: How to load my private DSA key for authentication? >________________________________ > From: Anthony Liu <ant...@ya...> >To: Salvador Fandino <sfa...@ya...> >Cc: "Ssh...@li..." <Ssh...@li...> >Sent: Monday, February 13, 2012 7:03 PM >Subject: Re: [Ssh-sftp-perl-users] Fwd: How to load my private DSA key for authentication? > > >OK, let's do this step by step. I have renamed Foreign.pm to Foreign.old.pm. And naturally, if I issue > > >perldoc Net::SFTP::Foreign > > >I get this: > > >No documentation found for "Net::SFTP::Foreign". > > >I guess I will need to specify the PERLLIB path. Just run cpan Net::SFTP::Foreign To download and install the latest version of the module from CPAN. If that doesn't work (for instance, if the machine is not connected to the internet), In order to keep you going, just copy the Foreign.pm file and Foreign directory from the Net-SFTP-Foreign-1.69.tar.gz distribution to the same place where you found the old ones, and try your script again. |