如何通过桌面上的远程服务器上的ssh启动带有命令的屏幕会话?
发布时间:2020-12-13 18:45:20 所属栏目:Linux 来源:网络整理
导读:我希望能够通过桌面上的单个ssh命令在远程服务器上启动屏幕会话.但是,屏幕似乎需要一个终端,当通过ssh运行命令时,该终端不可用. 所以很明显 ssh root@my.machine screen "tail -f /var/log/messages" (作为一个例子)不起作用,并给出 Must be connected to a
我希望能够通过桌面上的单个ssh命令在远程服务器上启动屏幕会话.但是,屏幕似乎需要一个终端,当通过ssh运行命令时,该终端不可用.
所以很明显 ssh root@my.machine screen "tail -f /var/log/messages" (作为一个例子)不起作用,并给出 Must be connected to a terminal. 我希望ssh在屏幕下启动命令,这样我就可以稍后登录并按照我想要的方式连接到手动启动的屏幕会话. 解决方法
尝试使用-t选项ssh
ssh -t root@my.machine screen "tail -f /var/log/messages" 从男人ssh -t Force pseudo-tty allocation. This can be used to execute arbi- trary 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. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |