in reply to Net::SFTP authentication problem

Try using Net::SFTP::Foreign instead.

It doesn't reimplement the SSH protocol in Perl but uses the SSH client provided by your OS to connect to the server.

Replies are listed 'Best First'.
Re^2: Net::SFTP authentication problem
by SeekerOfTruth (Initiate) on Oct 16, 2008 at 20:19 UTC
    Thanks. That helped. Using SFTP::Foreign I get public key authentication and I can put the file to the remote server. I am getting an error on the put even though the file makes it to the destination: "Couldn't setstat remote file (fsetstat): SSH_FILEXFER_ATTR_PERMISSIONS". I'll do some research and see if I can figure out it out.
      Probably, the server software (WS_FTP-SSH_6.1.1) does not support SFTP setattr operation.

      Try dissabling attribute copy on the put method:

      $sftp->put($local, $remote, copy_perm => 0);
        Salva, I am having the same issue: Couldn't setstat remote file (fsetstat): SSH_FILEXFER_ATTR_PERMISSIONS However, when I do what you suggest by adding copy_perm => 0, I get this error when my script runs: invalid option(s) 'copy_perm' at /opt/script.pl line 1392 Any ideas why that parameter is not working? Here is my code line: $sftp_connection->put($filepath, $remote_dir.$filename, copy_perm=>0); Thanks! Vic