Hi everyone, i'm trying to use key authentication using Net::OpenSSH. can someone please help me to understand the issue with my script
use Net::OpenSSH; use warnings; my $path = "/export/home/tenfold2/.ssh/"; $Net::OpenSSH::debug |= 16; my $t = Net::OpenSSH->new('ildep@sxm0019', master_opts => [-o => "U +serKnownHostsFile=/dev/null", -o => "StrictHostKeyChecking=no"], time +out => 10, ctl_dir => $path); $t->error and SendMail "unable to connect to remote host: ". $t->err +or; my $cmd = "ls -l";
When i run the script it gives below message:
x Connecting to sxm0019 command-line: line 0: Bad configuration option: ServerAliveInterval unable to connect to remote host: unable to establish master SSH conne +ction: master process exited unexpectedly
ssh -vvv ildep@sxm0019 echo "hello world" >/tmp/ssh.out 2>&1
/tmp/ssh.out: debug2: we did not send a packet, disable method debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Trying private key: /export/home/tenfold2/.ssh/identity debug3: no such identity: /export/home/tenfold2/.ssh/identity debug1: Trying public key: /export/home/tenfold2/.ssh/id_rsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Server accepts key: xx hint 1 debug2: input_userauth_pk_ok: xx debug3: sign_and_send_pubkey debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey) debug1: fd 6 setting O_NONBLOCK debug2: fd 7 is O_NONBLOCK debug1: channel 0: new [client-session] debug3: ssh_session2_open: channel_new: 0 debug1: send channel open 0 debug1: Entering interactive session. debug2: callback start debug1: ssh_session2_setup: id 0 debug1: Sending command: echo hello world debug1: channel request 0: exec debug2: callback done debug1: channel 0: open confirm rwindow 0 rmax 32768 debug2: channel 0: rcvd adjust 198560 debug1: channel 0: rcvd eof debug1: channel 0: output open -> drain debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: channel 0: rcvd close debug1: channel 0: close_read debug1: channel 0: input open -> closed debug3: channel 0: will not send data after close hello world debug3: channel 0: will not send data after close debug1: channel 0: obuf empty debug1: channel 0: close_write debug1: channel 0: output drain -> closed debug1: channel 0: almost dead debug1: channel 0: gc: notify user debug1: channel 0: gc: user detached debug1: channel 0: send close debug1: channel 0: is dead debug1: channel 0: garbage collecting debug1: channel_free: channel 0: client-session, nchannels 1 debug3: channel_free: status: The following connections are open: #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1) debug3: channel_close_fds: channel 0: r -1 w -1 e 7 debug1: fd 1 clearing O_NONBLOCK debug2: fd 2 is not O_NONBLOCK debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.1 seconds debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0 debug1: Exit status 0 rc: 0

In reply to Re^3: Net::OpenSSH key authentication by Shine
in thread Net::OpenSSH key authentication by Jarek

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.