http://www.perlmonks.org?node_id=590452

tphyahoo has asked for the wisdom of the Perl Monks concerning the following question:

SSHing in with an explicit user/password seems not to work for me using Net::SSH::Perl.

This seems to be the same problem, or a related problem, as in Net::SSH::Perl gotcha!

That was back in 2002, and I'm thinking there must be a fix in, or at least a better understanding of the problem. But I looked around and couldn't find anything.

Here is a snip from my terminal to show what is going wrong

Is there some gotcha involving Net::SSH::Perl that I need to know about?

$ ssh thartman@localhost # works fine Password: Linux none 2.4.29-linode39-1um #1 Wed Jan 19 12:22:14 EST 2005 i686 GN +U/Linux... etc, etc $ exit # get back to my original process logout Connection to localhost closed. $ cat net-ssh-perl.t # the code to connect via Net::SSH::Perl use strict; use warnings; use Net::SSH::Perl; use IO::Prompt; my $ssh_box = 'localhost'; my $ssh_login = prompt "$ssh_box user: "; my $ssh_password = prompt "$ssh_box password: ", -e => '*'; my $ssh = Net::SSH::Perl->new($ssh_box); $ssh->login($ssh_login, $ssh_password); $ perl net-ssh-perl.t # same login, same password localhost user: thartman localhost password: ********* Permission denied at net-ssh-perl.t line 14 $ head -n14 net-ssh-perl.t | tail -n 1 # echo line 14 -- of course, it +'s the login $ssh->login($ssh_login, $ssh_password); $

Much obliged for anybody that can point me in the right direction.

UPDATE, fwiw, doing the same thing with Net::SSH works fine

$ perl net-ssh.t localhost user: thartman localhost command: ls blee learning nbarter pari-2.1.7 pari-2.1.7.tgz pimpmycat pmc_external_dependencies shellenv $ cat net-ssh.t use strict; use warnings; use Net::SSH qw(sshopen2); use IO::Prompt; my $ssh_box = "localhost"; my $user = prompt "$ssh_box user: ";; my $cmd = prompt "$ssh_box command: "; sshopen2("$user\@$ssh_box", *READER, *WRITER, "$cmd") || die "ssh: $!" +; while (<READER>) { chomp(); print "$_\n"; } close(READER); close(WRITER);