据说,pssh的-x选项会传递额外的SSH命令行参数。 SSH的“-t”选项应该已经解决了“伪终端”错误。是否应该使用另一个pssh/ssh选项?

# 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

没有“-t”和“sudo”,该命令可以正常工作,但是我需要以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

最佳答案

尝试像这样运行pssh,以便两次指定“-t”选项:

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

ssh man page表示有关“-t”的内容(强调):



您显然正在以ssh没有本地tty的方式运行pssh。因此,您必须安排使用两次指定的“-t”运行ssh。即使没有本地tty,这也会强制ssh请求远程tty。

关于ssh - "Force psuedo-tty allocation"不会转换为pssh,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37197482/

10-10 16:35