我经常通过 SSH 连接到计算机只是为了让它进入睡眠状态。问题是当它休眠时,它会保持 SSH 连接打开(似乎是无限期的)。这是发生的事情:
oli@bert:~$ ssh tank
oli@tank:~$ sudo pm-suspend
[sudo] password for oli:
Run Code Online (Sandbox Code Playgroud)
我输入我的密码,点击Return然后它挂起......直到我唤醒远程机器。
有什么方法可以在本地强制断开连接,这样我就可以取回我的终端,而不必关闭它并启动另一个?
mur*_*uru 14
输入 SSH 转义码!来自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.
~& Background ssh at logout when waiting for forwarded connection /
X11 sessions to terminate.
Run Code Online (Sandbox Code Playgroud)
所以:按Enter~.。
| 归档时间: |
|
| 查看次数: |
1267 次 |
| 最近记录: |