You are using the same path on both systems. It might help you isolate the problem if you changed the path for one end at a time.
# cat test_sftp.cgi #!/usr/bin/perl -w use strict; use warnings; use Net::SFTP; my $from = 'TEST.txt'; my $to = '/sftp/tmp/TEST.txt'; my $server = 'X.X.X.X'; my $user = 'user'; my $sftp; my %args = ( ssh_args => { user => 'user', identity_files => [ '/root/.ssh/id_r +sa' ], debug => 1 } ); $sftp = Net::SFTP->new($server, %args) or die "could not open connection to $server\n"; $sftp->put($from, $to) or die "could not upload $file\n"; exit;
Are you running a system with Security Enhanced (SE) Linux (e.g. RedHat)? If so, there may be restrictions on your /sftp directory and/or ssh processes preventing access. If SELinux is preventing access it will probably be logging the faults. Check /var/log/messages (probably).
In reply to Re^9: transfer a file via SFTP
by ig
in thread transfer a file via SFTP
by cc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |