Hello dano63,
Welcome to the Monastery.
I would suggest to add this line after your connect to see the actual die error:
$sftp = Net::SFTP::Foreign->new($host); $sftp->error and die "unable to connect to remote host: " . $sftp->err +or;
Why you do not use SSH keys which is more secure and not required to apply to send the psw? Sample:
my %args = ( host => "localhost", user => "user", port => "22", # psw => "psw", key_path => "/home/user/.ssh/id_rsa" ); my $sftp = Net::SFTP::Foreign->new(%args); $sftp->die_on_error("Unable to establish SFTP connection");
Update: Fellow Monk salva provided you with an answer to your problem. In case you want to get a running sample of code using ssh keys in a relevant question Re: Generate temporary file and FTP upload.
Hope this helps, BR.
In reply to Re: Net::SFTP::Foreign Password Authentication Hangs (UPDATED)
by thanos1983
in thread Net::SFTP::Foreign Password Authentication Hangs
by dano63
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |