Re: [Ssh-sftp-perl-users] Fwd: How to load my private DSA key for authentication?
Brought to you by:
dbrobins
From: Steve P. <st...@fo...> - 2012-02-13 23:17:36
|
This is putty telling you that it doesn't know about this host as the host key isn't in puttys cache. You can add this by using putty manually to connect to the host and telling it to save the key in its cache. The reason the script fails is it (putty) is asking for an interactive response but, being a script there is no way to get this and so it exits. -- Steve. On 14/02/2012 5:58 AM, Anthony Liu wrote: > 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... > <mailto:ant...@ya...>> > >To: Salvador Fandino <sfa...@ya... <mailto:sfa...@ya...>> > >Cc: "Ssh...@li... > <mailto:Ssh...@li...>" > <Ssh...@li... > <mailto: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 > <http://Foreign.pm> to Foreign.old.pm <http://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. > > > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > > > > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |