据推测,pssh的-x选项传递额外的SSH命令行参数。SSH的"-t“选项应该已经处理了”伪终端“错误。还有另一个应该使用的pssh/ssh选项吗?
# 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没有"-t“和" sudo ",该命令可以正常工作,但我需要以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发布于 2016-05-12 22:17:34
尝试像这样运行pssh,以便指定两次"-t“选项:
pssh -i -H ec2-user@... -x "-t -t -i /tmp/key.pem" 'sudo hostname'
^^^^^ssh手册页提到了"-t“(重点是后加的):
-t 强制伪终端分配。这可以用于在远程计算机上执行基于屏幕的任意程序,这是非常有用的,例如在实现菜单服务时。多个-t选项强制分配tty,即使ssh没有本地tty.
显然,在运行pssh时,ssh没有本地tty。因此,您必须安排使用两次指定的"-t“运行ssh。这迫使ssh请求远程tty,尽管没有本地tty。
https://stackoverflow.com/questions/37197482
复制相似问题