具有以下操作系统:
- Linux Ubuntu(18.04 LTS)
当我执行ssh
命令时,我得到以下信息:
> ssh
usage: ssh [some characters shown] [-B bind_interface]
[-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
[-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
[-i identity_file] [-J [user@]host[:port]] [-L address]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-Q query_option] [-R address] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] destination [command]
根据Github
以下部分的文档:
有如下句子:
$ ssh -T git@hostname
从上面观察该-T
参数,它没有出现在第一个输出中。
它甚至没有出现在以下“官方”文档中SSH
:
但它出现在 Ubuntu 文档命令中:
这里我感到很困惑,因为在 Ubuntu 的文档中出现了-T
参数描述部分,但不在概要部分。问题 1:为什么会有这种差异?
顺便说一下,我在 Ubuntu 中执行apt update
了apt upgrade
当我执行命令时,$ ssh -T git@hostname
我没有收到有关参数无效的错误-T
。因此它是有效的,但它没有出现在第一个输出中。
问题2:-T
如果理论上是一个无效参数,为什么命令执行没有失败?
问题 3:什么时候强制使用-T
?
Α
使用dpkg -l openssh-client
命令显示:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=============================================-===========================-===========================-===============================================================================================
ii openssh-client 1:7.6p1-4ubuntu0.3 amd64 secure shell (SSH) client, for secure access to remote machines
对于ssh -V
命令显示:
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
答案1
T
事实上,在您编辑的概要部分中提到了该选项:
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]
[-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]
[user@]hostname [command]
用法描述如下man ssh
:
-T Disable pseudo-terminal allocation.
本质上相反的是-t
:
-t Force pseudo-terminal allocation. This can be used to execute
arbitrary screen-based programs on a remote machine, which can be
very useful, e.g. when implementing menu services. Multiple -t
options force tty allocation, even if ssh has no local tty.
概要显示它是“喜欢”[some characters shown]
而不是“像”,[-p port]
因为它是不需要争论的(众多)选项之一。