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); }
In reply to Error with Net::SFTP:Foreign by ScooterTrash
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |