use*_*618 2 ssh remote-access python-3.4
据推测,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
Run Code Online (Sandbox Code Playgroud)
没有"-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
Run Code Online (Sandbox Code Playgroud)
尝试像这样运行pssh,以便指定"-t"选项两次:
pssh -i -H ec2-user@... -x "-t -t -i /tmp/key.pem" 'sudo hostname'
^^^^^
Run Code Online (Sandbox Code Playgroud)
该SSH手册页说,这个关于"-t"(强调):
-t
强制伪终端分配.这可以用于在远程机器上执行任意基于屏幕的程序,这可以是非常有用的,例如在实现菜单服务时.多个-t选项强制tty分配,即使ssh没有本地tty.
你显然是在运行pssh,以至于ssh没有本地tty.所以你必须安排ssh运行两次指定"-t".这迫使ssh请求远程tty,尽管没有本地tty.
| 归档时间: |
|
| 查看次数: |
2162 次 |
| 最近记录: |