in reply to NET SFTP disconnects

Hi Salva Thanks for that I asked a client for a copy of the script to see if they had amended it and found they had changed the following line after you pointed out the 10 seconds timeout also its using a password not a public key! I'm hoping that will solve the issue # attempt connecton to SFTP site #$sftp = Net::SFTP::Foreign->new( $username . '@' . $sftpServer, timeout => 60, password => $password); $sftp = Net::SFTP::Foreign->new( $username . '@' . $sftpServer, timeout => 10, more => -o => 'PreferredAuthentications=publickey');

Replies are listed 'Best First'.
Re^2: NET SFTP disconnects
by thanos1983 (Parson) on Apr 12, 2019 at 09:34 UTC

    Hello DesmondL,

    Welcome to the Monastery. I am not the expert here (far from that), fellow Monk salva is. If I am not mistaken he also is the author of the package Net::SFTP::Foreign.

    Having said that, I would propose to modify the script with the following part:

    my %args = ( host => "localhost", user => "user", port => "22", # psw => "psw", more => [qw(-o PreferredAuthentications=publickey)], key_path => "/home/user/.ssh/id_rsa" ); my $sftp = Net::SFTP::Foreign->new(%args); $sftp->die_on_error("Unable to establish SFTP connection");

    Modify the parameters to your needs.

    Hope this helps, BR

    Seeking for Perl wisdom...on the process of learning...not there...yet!