run*_*uhl 21
您可以检查是否设置了$SSH_CLIENT和$SSH_TTY变量:
(through SSH) $ [[ -z $SSH_TTY ]]; echo $?
1
(local) $ [[ -z $SSH_TTY ]]; echo $?
0
Run Code Online (Sandbox Code Playgroud)
该$SSH_CLIENT变量包含您正在连接的 IP,以及远程和本地端口:
(through SSH) $ echo $SSH_CLIENT
15.3.25.189 54188 22
Run Code Online (Sandbox Code Playgroud)
尝试按Enter然后按~?。
如果您使用的是 OpenSSH 客户端,您应该会收到一个支持的转义序列列表,这些转义序列执行其他功能。
$ ~?
Supported escape sequences:
~. - terminate connection (and any multiplexed sessions)
~B - send a BREAK to the remote system
~C - open a command line
~R - request rekey
~V/v - decrease/increase verbosity (LogLevel)
~^Z - suspend ssh
~# - list forwarded connections
~& - background ssh (when waiting for connections to terminate)
~? - this message
~~ - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)
Run Code Online (Sandbox Code Playgroud)
这将验证本地机器上的连接状态,而不是检查远程机器上设置的环境变量,因此受远程配置的影响。
| 归档时间: |
|
| 查看次数: |
2919 次 |
| 最近记录: |