Hi

Using Net::OpenSSH to SSH into a remote ox and getting "Pseudo-terminal will not be allocated because stdin is not a terminal." error. Can anyyone provide insights how to solve this issue. Thanks.

#!/usr/bin/perl use strict; use warnings; use Net::OpenSSH; my $user = ""; my $passwd = ""; my $host = ""; my @cmd = "show clock"; my @quitcmd = "exit"; my $ssh = Net::OpenSSH->new("$host", user => "$user", passwd => "$pass +wd", timeout => 90 ); $ssh->error and die "Couldn't establish SSH connection: ". $ssh->error; my @output = $ssh->capture({stdin_data => "@cmd\n@quitcmd\n"}); $ssh->error and die "Couldn't run remote command: ". $ssh->error; #close the ssh session undef $ssh;

Error

# open_ex: ['ssh','-O','check','-T','-S','/root/.libnet-openssh-perl/u +ser-10.253.10.10-25248-962213','-l','user','10.253.10.10','--'] # _waitpid(25251) => pid: 25251, rc: 0, err: # open_ex: ['ssh','-S','/root/.libnet-openssh-perl/user-10.253.10.10-2 +5248-962213','-l','user','10.253.10.10','--'] Pseudo-terminal will not be allocated because stdin is not a terminal. # _waitpid(25252) => pid: 25252, rc: 65280, err: Couldn't run remote command: child exited with code 255 at script.pl l +ine 42. # open_ex: ['ssh','-O','exit','-T','-S','/root/.libnet-openssh-perl/us +er-10.253.10.10-25248-962213','-l','user','10.253.10.10','--'] # _waitpid(25253) => pid: 25253, rc: 0, err:

In reply to How to solve Pseudo terminal issue OpenSSH by waytoperl

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.