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 ec2-user@xxx.xxx.xxx.xx1 -H ec2-user@xxx.xxx.xxx.xx2 -x "-t -i /tmp/key.pem" 'sudo hostname'
[1] 13:46:54 [FAILURE] ec2-user@xxx.xxx.xxx.xx1 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] ec2-user@xxx.xxx.xxx.xx1 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 ec2-user@xxx.xxx.xxx.xx1 -H ec2-user@xxx.xxx.xxx.xx2 -x "-i /tmp/key.pem" 'hostname'
[1] 14:08:35 [SUCCESS] ec2-user@xxx.xxx.xxx.xx1
ip-10-0-0-140
[2] 14:08:35 [SUCCESS] ec2-user@xxx.xxx.xxx.xx2
ip-10-0-0-139
up vote 5 down vote accepted

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.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.