我的MacBook上有一个MacBook配置文件,用于连接到远程Ubuntu服务器。配置文件如下所示:
Host remote_computer
HostName 1.2.3.4
Port 22
User remote_username
IdentityFile ~/.ssh/id_rsa
RemoteCommand echo "Hello, World!"下面是我尝试连接时所发生的事情:
local_computer:/ local_username$ ssh remote_computer
Hello, World!
local_computer:/ local_username$ RemoteCommand成功运行,但随后连接立即关闭。我尝试的任何RemoteCommand都会发生这种情况,但是如果我从配置文件中删除RemoteCommand,则连接将保持打开状态:
local_computer:/ local_username$ ssh remote_computer
remote_username@remote_computer:~$ Why在成功运行配置文件 RemoteCommand from之后是否关闭连接,我能做什么来阻止?
发布于 2019-06-14 18:51:41
强制TTY并输入shell:
Host remote_computer
HostName 1.2.3.4
Port 22
User remote_username
IdentityFile ~/.ssh/id_rsa
RemoteCommand echo "Hello, World!" && bash
RequestTTY forcehttps://unix.stackexchange.com/questions/524969
复制相似问题