简体   繁体   English

打开一个新终端并通过 ssh 连接到远程机器

[英]Open a new terminal and ssh to a remote machine

I want to open a new terminal and ssh to a remote machine in the opened terminal, and this terminal has to be kept open so that it can be used later to work on.我想在打开的终端中打开一个新终端和 ssh 到远程机器,并且这个终端必须保持打开状态,以便以后可以使用它来工作。

I tried the command : gnome-terminal -x ssh user@IPaddress .我尝试了命令: gnome-terminal -x ssh user@IPaddress But I am unable to give any commands in the newly opened terminal.但是我无法在新打开的终端中发出任何命令。

Can anyone please tell me where I am wrong and correct me?谁能告诉我我错在哪里并纠正我?

Thanks in advance, Saeya提前致谢,赛亚

我只是完全测试了您编写的代码(当然,插入了有效的用户和 IP)并且运行良好,所以我看不出您哪里出错了。

如果您的会话在建立后超时,您可以将 ServerAliveInterval 选项添加到命令行

gnome-terminal -e 'ssh -o ServerAliveInterval=60 -l user server'

以下命令成功运行: gnome-terminal --window-with-profile=NOCLOSEPROFILE -e "ssh -X $user@$IPaddress"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM