zengargoyle has asked for the wisdom of the Perl Monks concerning the following question:
The documentation makes it sound like the following code would work (using RSA Authentication).
$ssh->login([ $user [, $password ] ]) Sets the username and password to be used when authenticating with the sshd daemon. The username $user is required for all authentication protocols (to identify yourself to the remote server), but if you don't supply it the username of the user executing the program is used. The password $password is needed only for password authentication (it's not used for passphrases on encrypted RSA/DSA identity files, though perhaps it should be). And if you're running in an interactive session and you've not provided a password, you'll be prompted for one.
use Net::SSH::Perl; $ssh = Net::SSH::Perl->new('localhost', debug=>1); $ssh->login() or die "login fail!\n"; ($i,$j,$k) = $ssh->cmd('ls | wc -l'); print "$i\n";
It doesn't.
localhost.localdomain: Reading configuration data /home/MYUSERNAME/.ss +h/config localhost.localdomain: Reading configuration data /etc/ssh_config localhost.localdomain: Connecting to localhost, port 22. localhost.localdomain: Remote protocol version 1.5, remote software ve +rsion 1.2.32 localhost.localdomain: Net::SSH::Perl Version 1.23, protocol version 1 +.5. localhost.localdomain: No compat match: 1.2.32. localhost.localdomain: Connection established. login fail!
However, if I explicitly give MYUSERNAME and a FAKE password...
$ssh->login('MYUSERNAME','FAKEPASS') or die "login fail!\n"; localhost.localdomain: Reading configuration data /home/MYUSERNAME/.ss +h/config localhost.localdomain: Reading configuration data /etc/ssh_config localhost.localdomain: Connecting to localhost, port 22. localhost.localdomain: Remote protocol version 1.5, remote software ve +rsion 1.2.32 localhost.localdomain: Net::SSH::Perl Version 1.23, protocol version 1 +.5. localhost.localdomain: No compat match: 1.2.32. localhost.localdomain: Connection established. localhost.localdomain: Waiting for server public key. localhost.localdomain: Received server public key (768 bits) and host +key (1024 bits). localhost.localdomain: Host 'localhost' is known and matches the host +key. localhost.localdomain: Encryption type: DES3 localhost.localdomain: Sent encrypted session key. localhost.localdomain: Received encryption confirmation. localhost.localdomain: Trying rhosts authentication. localhost.localdomain: Trying rhosts or /etc/hosts.equiv with RSA host + authentication. localhost.localdomain: Rhosts with RSA authentication failed: Can't lo +ad private host key. localhost.localdomain: Trying RSA authentication with key 'MYUSERNAME@ +localhost.localdomain' localhost.localdomain: Received RSA challenge from server. localhost.localdomain: Sending response to host key RSA challenge. localhost.localdomain: RSA authentication accepted by server. localhost.localdomain: Sending command: ls | wc -l localhost.localdomain: Entering interactive session. 127
Anybody else run into this sorta thing?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Net::SSH::Perl gotcha!
by premchai21 (Curate) on May 24, 2002 at 19:20 UTC | |
by zengargoyle (Deacon) on May 24, 2002 at 19:48 UTC | |
Re: Net::SSH::Perl gotcha!
by tphyahoo (Vicar) on Dec 18, 2006 at 15:31 UTC |