Just started experimenting with Perl, and my goal in this little project is to ssh to remote host(s) and process some files, run some commands, and stuff..I am able to ssh user@localhost from the command line but I seem to be doing something wrong in my script:

my $ssh = Net::SSH::Perl->new($host, debug=>1, protocol=>'2', identity +_files=>["/Users/jaldama /.ssh/id_dsa.pub"], ); $ssh->login($user); . . .

and this is what happens!:

jaldama$ perl hostcheck.pl Jackie-Aldamas-MacBook.local: Reading configuration data /Users/jaldam +a/.ssh/config Jackie-Aldamas-MacBook.local: Reading configuration data /etc/ssh_conf +ig Jackie-Aldamas-MacBook.local: Connecting to localhost, port 22. Jackie-Aldamas-MacBook.local: Remote protocol version 2.0, remote soft +ware version OpenSSH_5.2 Math::BigInt: couldn't load specified math lib(s), fallback to Math::B +igInt::FastCalc at /Library/Perl/5.10.0/Crypt/DH.pm line 6 Jackie-Aldamas-MacBook.local: Net::SSH::Perl Version 1.34, protocol ve +rsion 2.0. .ackie-Aldamas-MacBook.local: No compat match: OpenSSH_5.2 Jackie-Aldamas-MacBook.local: Connection established. Jackie-Aldamas-MacBook.local: Sent key-exchange init (KEXINIT), wait r +esponse. Jackie-Aldamas-MacBook.local: Algorithms, c->s: 3des-cbc hmac-sha1 non +e Jackie-Aldamas-MacBook.local: Algorithms, s->c: 3des-cbc hmac-sha1 non +e Jackie-Aldamas-MacBook.local: Entering Diffie-Hellman Group 1 key exch +ange. Jackie-Aldamas-MacBook.local: Sent DH public key, waiting for reply. Jackie-Aldamas-MacBook.local: Received host key, type 'ssh-dss'. Jackie-Aldamas-MacBook.local: Host 'localhost' is known and matches th +e host key. Jackie-Aldamas-MacBook.local: Computing shared secret key. Jackie-Aldamas-MacBook.local: Verifying server signature. Jackie-Aldamas-MacBook.local: Waiting for NEWKEYS message. Jackie-Aldamas-MacBook.local: Send NEWKEYS. Jackie-Aldamas-MacBook.local: Enabling encryption/MAC/compression. Jackie-Aldamas-MacBook.local: Sending request for user-authentication +service. Jackie-Aldamas-MacBook.local: Service accepted: ssh-userauth. Jackie-Aldamas-MacBook.local: Trying empty user-authentication request +. Jackie-Aldamas-MacBook.local: Authentication methods that can continue +: publickey,keyboard-interactive. Jackie-Aldamas-MacBook.local: Next method to try is publickey. Jackie-Aldamas-MacBook.local: Trying pubkey authentication with key fi +le '/Users/jaldama/.ssh/id_dsa.pub' Jackie-Aldamas-MacBook.local: Will not query passphrase for '/Users/ja +ldama/.ssh/id_dsa.pub' in batch mode. Jackie-Aldamas-MacBook.local: Loading private key failed. Permission denied at hostcheck.pl line 18

So I figured maybe I should run in interactive mode so it would prompt for the password...but i'm not being prompted for the password when I set it to 1.


In reply to SSH using Net::SSH::Perl, Having issues connecting by jaldama

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.