And*_*eea 350 linux ssh virtualbox
我正在通过 SSH 连接到服务器,以使用如下命令向套接字服务器发送消息:
SSH 181.169.1.2 -p 5566
建立连接并编写消息并发送后,我无法退出文本模式。我只允许输入更多文本,仅此而已。
是否有命令或组合键可以让我返回命令模式?
Aar*_*all 312
如何退出 SSH 连接?
两种方式:
exit, 后跟Enter, 或~.ssh 应立即关闭并返回到您的命令提示符。第一个选项应该很直观,但是我们怎么知道后一个选项呢?
我们可以通过仔细阅读手册页来了解这些信息。
$ man ssh
Run Code Online (Sandbox Code Playgroud)
为我们提供了 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.
~B Send a BREAK to the remote system (only useful if the peer sup?
ports it).
~C Open command line. Currently this allows the addition of port
forwardings using the -L, -R and -D options (see above). It
also allows the cancellation of existing port-forwardings with
-KL[bind_address:]port for local, -KR[bind_address:]port for
remote and -KD[bind_address:]port for dynamic port-forwardings.
!command allows the user to execute a local command if the
PermitLocalCommand option is enabled in ssh_config(5). Basic
help is available, using the -h option.
~R Request rekeying of the connection (only useful if the peer
supports it).
~V Decrease the verbosity (LogLevel) when errors are being written
to stderr.
~v Increase the verbosity (LogLevel) when errors are being written
to stderr.
Run Code Online (Sandbox Code Playgroud)
exitssh没有什么特别之处,它只是一种退出 shell 的方式,这会导致关闭 ssh 会话:
$ type exit
exit is a shell builtin
$ help exit
exit: exit [n]
Exit the shell.
Exits the shell with a status of N. If N is omitted, the exit status
is that of the last command executed.
Run Code Online (Sandbox Code Playgroud)
引用和引用参考来源是为了提供进一步的证据,否则可能是可证明的事实断言,并告知用户可以存储更多相关信息的位置。
你想知道你在做语义上正确的事情,以及知道它是有效的。
您不想学习将记录为错误然后“修复”的内容作为功能调用。将继续支持做语义正确的事情。
Dub*_*ubu 311
简答:类型 exit
但是,如果这不起作用...
大多数 SSH 实现都为交互式会话实现了转义字符,类似于 telnet 的Ctrl-]组合。默认的 SSH 转义字符是~,在行首输入。
如果您想终止一个卡住exitCtrlD的交互式 OpenSSH 会话,并且无法通过进入或进入远程端的 shell退出,您可以输入~后跟一个点.。要确保在输入行的开头输入转义字符,您应该先按 Enter。因此,在大多数情况下,以下序列将终止 SSH 会话:
Enter~.
例如,OpenSSH 提供了除~.. ~?在会话期间输入应该会给你一个列表。一些例子:
~随后Ctrl-Z暂停会议,~& 将其直接放入背景中,~# 给出此会话中转发的连接列表。 ~~。可以使用命令行选项更改转义字符-e。如果您设置了特殊值-e none,转义将被禁用并且会话是完全透明的。
另请参阅命令行选项下的ssh 上的 OpenBSD 手册页(从www.openssh.org引用)-e
小智 8
这些是受支持的字符,它们提供了您可以使用 ssh 的各种选项。
支持的转义序列:
~. - terminate session
~B - send a BREAK to the remote system
~R - Request rekey (SSH protocol 2 only)
~# - list forwarded connections
~? - this message
~~ - send the escape character by typing it twice
Run Code Online (Sandbox Code Playgroud)
(请注意,仅在换行符之后立即识别转义符。)您可以通过点击 关闭转义序列列表Enter。
MacOS:当 ssh 挂起时,请使用以下顺序:
ENTER
SHIFT+`
.
Run Code Online (Sandbox Code Playgroud)
其中: shift+` 产生~(波浪号字符)
| 归档时间: |
|
| 查看次数: |
957720 次 |
| 最近记录: |