in reply to SFTP Issue

See if you at least can connect.
#!/usr/bin/perl -w use strict; use Net::SFTP; # Net::SFTP does no error reporting my $sftp = undef; eval{ $sftp = Net::SFTP->new("hostnumber", user=>"me", password=>"mypass", ); }; if ($@) { print "Sftp connection failed:\n $@\n"; } if (! $sftp) { print "I can't connect!\n"; }else{ print "SUCCESS!\n"; }
If you can connect, it is likely you get permission denied because the file you seek is not in the directory that you think you are in. Try the fullpathname to the file.

If you can't connect, try Net::SSH2. See A little demo for Net::SSH2 for how to sftp thru it.


I'm not really a human, but I play one on earth CandyGram for Mongo

Replies are listed 'Best First'.
Re^2: SFTP Issue
by prasanna14 (Initiate) on Jul 15, 2008 at 18:05 UTC
    Hi Zentara ,
    I tried the code , i am still getting errors , please find the error below
    Sftp connection failed:
    Permission denied at //pkgs/linux/intel/perl/5.8.0/lib/site_perl/5.8.0/Net/SFTP.pm line 62
    I can't connect!
    Do we need to give the password for sure ? coz when i check in the line 62 of SFTP.pm it corresponds to login using username and password
    Net::ssh2 module is not installed , i need to ask the team to install, i will try that option
    I am able to connect from commandline by using "sftp user@host" withought any password.
    Prasanna