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

Okay, I've given up on capturing stderr in traditional methods. I do, however, have another problem.
#!/usr/bin/perl # # use Net::SSH::Perl; my $host = "mynode"; my $user = "user"; my $pass = "pass"; my $ssh = Net::SSH::Perl->new($host, options => ["RhostsAuthentication + no"]); $ssh->login($user, $pass); my ( $stdout, $stderr, $exit ) = $ssh->cmd('uptime'); chomp $stdout; print "$stdout\n";
On two specific nodes, I get "Permission denied" when the script tries to log in. However, when using the shell, ssh user@host, and entering the pass when prompted always works. Dose this mean that Net::SSH::Perl is not using password authentication, and is trying to use an rsa key? I think this is a setting in the sshd_config file, but am not sure which one to be honest. I need the apache user to do the ssh'ing, so setting up keys is a bit tricky.

Cheers.

Replies are listed 'Best First'.
Re: Net::SSH::Perl authentication
by u235sentinel (Hermit) on Nov 25, 2005 at 04:31 UTC
    On two specific nodes, I get "Permission denied" when the script tries to log in.

    On two? Does it do this on other's as well or only those two? Might help resolving what's going on here

    Dose this mean that Net::SSH::Perl is not using password authentication, and is trying to use an rsa key?

    I did see something on the perldoc page suggesting it can read identity files. I haven't done it this way myself however. Have you tried removing the RhostAuthentication option in your code? Everything else looks similar to what I've seen done. Just a thought.