ScooterTrash has asked for the wisdom of the Perl Monks concerning the following question:
I have a script that connects to several systems (linux to linux) via SFTP and checks for the existance of a file. When connecting to one host I get the error "the authenticity of the target host can not be established, connect from the command line first".
I have successfully connected from the command line and the remote host's key is in the known_hosts file." This is happening only on one system. I have tried setting "PreferredAuthentications=password" also with the same results.
Here is the code snippet
sub SFTPTest() { my $whoami=qx(whoami); my $id=qx(id); $protocol = "SFTP"; $Port = $SFTPPort; my $SftpConn = Net::SFTP::Foreign ->new(host=>$HostFQDN, user=>$st +nocuser, password=>$passwd, port=>$Port, timeout=>$TimeOut); my $SftpConnErr = $SftpConn->error; if ($SftpConnErr) { my $SftpConnStatus =$SftpConn->status; $ErrorState = &CheckErrorMsg($SftpConnStatus); return ($ErrorState); } my $SftpConnLsMsg = $SftpConn->ls; $SftpConnErr = $SftpConn->error; if ($SftpConnErr) { my $SftpConnStatus =$SftpConn->status; $ErrorState = &CheckErrorMsg($SftpConnStatus); } $SftpConn->disconnect; return($ErrorState); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error with Net::SFTP:Foreign
by pileofrogs (Priest) on Aug 11, 2010 at 17:55 UTC | |
by ScooterTrash (Novice) on Aug 11, 2010 at 18:59 UTC | |
|
Re: Error with Net::SFTP:Foreign
by Khen1950fx (Canon) on Aug 11, 2010 at 19:53 UTC | |
|
Re: Error with Net::SFTP:Foreign
by salva (Canon) on Aug 22, 2010 at 09:10 UTC |