远程重启后 SSH 终端锁定

远程重启后 SSH 终端锁定

每当我远程登录到另一台机器时我都会输入:

sudo 重启

终端锁定了很长一段时间。到目前为止,我想到的唯一解决方案是

sudo 重启 && 退出 && 退出

第二次退出是因为有时第一次在毫秒响应中不起作用。

我想知道是否有一种更漂亮的方法来做这件事,使得终端不会锁定而仅仅停留在本地机器上。

答案1

你读了man ssh吗?它展示了如何使用“转义字符”序列:

ESCAPE CHARACTERS
     When a pseudo-terminal has been requested, ssh supports a number of
     functions through the use of an escape character.

     A single tilde character can be sent as ~~ or by following the tilde by a
     character other than those described below.  The escape character must
     always follow a newline to be interpreted as special.  The escape
     character can be changed in configuration files using the EscapeChar
     configuration directive or on the command line by the -e option.

     The supported escapes (assuming the default ‘~’) are:

     ~.      Disconnect.

     ~^Z     Background ssh.

     ~#      List forwarded connections.

     ~&      Background ssh at logout when waiting for forwarded connection /
             X11 sessions to terminate.

     ~?      Display a list of escape characters.

相关内容