tcampion has asked for the wisdom of the Perl Monks concerning the following question:

Need some help. Trying to use Net::openSSH but running into an error and cant seem to find a solution googling or looking at the docs. I'm able to succesfully log into a jump server with this code but not continue on to the next host. I get the following error. Pseudo-terminal will not be allocated because stdin is not a terminal. I guess my problem is telling Net::openSSh how to act like a terminal. I tried connecting with tty => 1 in the options but that produced the same results for me.

#!/usr/bin/perl -w use strict; use Net::OpenSSH; my $host = 'myhost.com'; my $user = 'myusername'; my $passwd = 'mypassword'; my $ssh = Net::OpenSSH->new($host, user => $user, passwd => $passw +d); $ssh->error and die "Can't ssh to $host: " . $ssh->error; #my @ls = $ssh->capture("ssh myusername\@192.168.1.50"); #$ssh->error and # die "remote ls command failed: " . $ssh->error;

Replies are listed 'Best First'.
Re: Net::OpenSSH tty error
by salva (Canon) on Jul 12, 2011 at 21:06 UTC
    try...
    my @ls = $ssh->capture({tty => 1}, "ssh myusername\@192.168.1.50 ls");

      After trying your line I see the following output.

      process_mux_new_session: tcgetattr: Invalid argument

        I don't fully understand what you want to do, so, in order to clarify it, could you post here a capture of the process you want to automate done from a shell?