Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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?


In reply to Net::SSH::Perl gotcha! by zengargoyle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-19 08:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found