in reply to Re^3: SFTP Issue
in thread SFTP Issue

Khen , Thanks for your reply , actually we are connecting to a vendor for few files , So is it that we need to ask the vendor for passwords to be set for our account.

if password is set for our account , then will it use the publick keys?

Also in the NET::SFTP module in SFTP they have mentioned under "password " as "if you use public key authentication, this argument is unused" .

Replies are listed 'Best First'.
Re^5: SFTP Issue
by Khen1950fx (Canon) on Jul 16, 2008 at 19:25 UTC
    Check with your vendor concerning auth methods. In my case, my vendors gave me a password when I registered, so I use passwords to connect. Also, if you are using public keys, then yes, Net::SFTP will ignore the password and use public keys, if it is set up correctly.
      Khen
      if we use password to authenticate , will it use the public keys then..(just wanted to know) iused the following piece of code , it seems to connect and sending the "ls" command, but i am not getting any reply back

      use strict; use warnings; use Net::SSH::Perl; my $host = "217.154.215.76"; my $user = "etrade"; my $cmd = "ls rolling*"; my $ssh = Net::SSH::Perl->new($host, debug => 1, identity_files => ["/ +etrade/home/ibia_ir/.ssh/id_rsa"], protocol=>'2,1'); $ssh->login($user); my($stdout, $stderr, $exit) = $ssh->cmd($cmd); print "$stdout"; print "$stderr"; print "$exit";
        Khen , i am able to login and list files using the following code now, but not able to get the files

        use strict; use warnings; use Net::SFTP; my $host = "hostname"; my $user = "username"; my $remote = './trade_080417_121605.csv'; my $ssh= Net::SFTP->new($host , user=>$user,ssh_args => [ identity_fil +es => [ "/etrade/home/ibia_ir/.ssh/id_rsa"],debug => '1']); $ssh->ls("." , sub { print $_[0]->{longname}, "\n" });
        any thoughts how to proceed further??

        Thanks in advance