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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |