in reply to Re^2: Net:SSH2 channels
in thread Net:SSH2 channels
$ssh2->auth_ok();$ssh2->auth_password($login{user}, $login{password}) or die "Auth failed";
On Srawberry Perl, I'm finding that auth_password won't work now that I've got public key authorization set up. (Not sure if that's "just me", or "just windows", or "just the way it's supposed to be".)$ssh2->auth_ok() or die "Not authorized";
Works fine for me - but doesn't necessarily help you ;-)use warnings; use Net::SSH2; use strict; my @output; my $ssh = Net::SSH2->new(); $ssh->connect("host") or die "Unable to connect host\n"; # auth_password no longer working for me # $ssh->auth_password("user", "password") # or die "Failed to auth\n"; # using auth_publickey works $ssh->auth_publickey( "user", "C:\\cygwin\\home\\user\\.ssh\\id_rsa.pub", "C:\\cygwin\\home\\user\\.ssh\\id_rsa", 0) or die "Auth failed"; die "Not authenticated" unless $ssh->auth_ok; # Double checking my $channel = $ssh->channel() or die "Channel creation failed\n"; $channel->blocking(1); $channel->exec("ls ~"); while (<$channel>) {push @output, $_} print scalar @output, "\n"; # See no. of entries print for @output;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Net:SSH2 channels
by BernieC (Pilgrim) on Aug 08, 2018 at 14:02 UTC | |
by syphilis (Archbishop) on Aug 09, 2018 at 11:25 UTC |