2014-10-07 157 views
0

我试图用ssh登录来运行命令。用ssh执行命令

ls命令工作正常,

[email protected]:~$ ssh -o "StrictHostKeyChecking no" -o "PasswordAuthentication no" -i /root/.juju/ssh/juju_id_rsa [email protected] ls 

给文件列表/目录

但是,当我使用ssh运行/bin/bash它挂(不响应输出)。

[email protected]:~$ ssh -o "StrictHostKeyChecking no" -o "PasswordAuthentication no" -i /root/.juju/ssh/juju_id_rsa [email protected] /bin/bash 

当我在192.168.50.2上运行/bin/bash时,没有输出,但命令返回。如果ssh命令没有从ssh返回,原因是什么?

+4

你正在启动一个交互式shell,它不会挂起,它正在等待你给它一些输入。 – arco444 2014-10-07 10:55:03

+0

非常感谢arco。我现在明白了。 – 2014-10-07 10:57:55

回答

1

当您运行/bin/bash时,您正在分叉一个新的bash进程,就像启动终端时一样。

就像使用终端bash一样,bsh over ssh将等待你给它进一步的指示,然后它将任何输出返回给你。