Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Force psuedo-tty allocation" doesn't translate to pssh

Supposedly, pssh's -x option passes along extra SSH command-line arguments. SSH's "-t" option should have taken care of the "Pseudo-terminal" error. Is there another pssh/ssh option that should be used?

# pssh -i -H [email protected] -H [email protected] -x "-t -i /tmp/key.pem" 'sudo hostname'
[1] 13:46:54 [FAILURE] [email protected] Exited with error code 1
Stderr: Pseudo-terminal will not be allocated because stdin is not a terminal.
sudo: sorry, you must have a tty to run sudo
[2] 13:46:54 [FAILURE] [email protected] Exited with error code 1
Stderr: Pseudo-terminal will not be allocated because stdin is not a terminal.
sudo: sorry, you must have a tty to run sudo

Without the "-t" and the "sudo", the command works fine, but I need to run some commands as sudo.

# pssh -i -H [email protected] -H [email protected] -x "-i /tmp/key.pem" 'hostname'
[1] 14:08:35 [SUCCESS] [email protected]
ip-10-0-0-140
[2] 14:08:35 [SUCCESS] [email protected]
ip-10-0-0-139
like image 424
user2569618 Avatar asked May 12 '16 21:05

user2569618


1 Answers

Try running pssh like this, so that the "-t" option is specified twice:

pssh -i -H ec2-user@... -x "-t -t -i /tmp/key.pem" 'sudo hostname'
                            ^^^^^

The ssh man page says this about "-t" (emphasis added):

-t
Force pseudo-terminal allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.

You are apparently running pssh in such a way that ssh has no local tty. So you have to arrange for ssh to be run with "-t" specified twice. This forces ssh to request a remote tty, despite not having a local tty.

like image 77
Kenster Avatar answered Oct 11 '22 23:10

Kenster