@
ob @
corvofeng @
charlie21 为验证这些问题, 我将 id_rsa_com 和 id_rsa_net 分别移动到其他文件夹下.
将 config 文件中的所有内容注释, 删除 known_hosts 和 known_hosts.old
执行 ssh-add -D && ssh-add -l 确认没有内容后:
先移动 net 的 Key 后执行 ssh-add -k $HOME/.ssh/id_rsa_net
后移动 com 的 Key 后执行 ssh-add -k $HOME/.ssh/id_rsa_com
编辑 config 将 Host net 的内容移动到 Host com 之前, 其他只字未改.
执行 ssh -Tv git@net, 结果如下:
```
OpenSSH_8.8p1, OpenSSL 3.0.5 5 Jul 2022
debug1: Reading configuration data /home/umze/.ssh/config
debug1: /home/umze/.ssh/config line 2: Applying options for net
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: configuration requests final Match pass
debug1: re-parsing configuration
debug1: Reading configuration data /home/umze/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: Executing proxy command: exec ncat --proxy 127.0.0.1:1089 --proxy-type socks5
github.com 22
debug1: identity file $HOME/.ssh/id_rsa_net type -1
debug1: identity file $HOME/.ssh/id_rsa_net-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.8
debug1: Remote protocol version 2.0, remote software version babeld-f33ee42f
debug1: compat_banner: no match: babeld-f33ee42f
debug1: Authenticating to
github.com:22 as 'git'
debug1: load_hostkeys: fopen /home/umze/.ssh/known_hosts: No such file or directory
debug1: load_hostkeys: fopen /home/umze/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher:
[email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher:
[email protected] MAC: <implicit> compression: none
debug1: kex: curve25519-sha256 need=32 dh_need=32
debug1: kex: curve25519-sha256 need=32 dh_need=32
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU
debug1: load_hostkeys: fopen /home/umze/.ssh/known_hosts: No such file or directory
debug1: load_hostkeys: fopen /home/umze/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: hostkeys_find_by_key_hostfile: hostkeys file /home/umze/.ssh/known_hosts does not exist
debug1: hostkeys_find_by_key_hostfile: hostkeys file /home/umze/.ssh/known_hosts2 does not exist
debug1: hostkeys_find_by_key_hostfile: hostkeys file /etc/ssh/ssh_known_hosts does not exist
debug1: hostkeys_find_by_key_hostfile: hostkeys file /etc/ssh/ssh_known_hosts2 does not exist
The authenticity of host '
github.com (<no hostip for proxy command>)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '
github.com' (ED25519) to the list of known hosts.
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: Will attempt key:
[email protected] RSA SHA256:eQ5AqN8Y+p9cGo8eVzcxOMmJgDN3ivpCbcgA7jkkXeI agent
debug1: Will attempt key:
[email protected] RSA SHA256:H790emQkwtjDRSnGyRxp0e+HnlxlAY5ruEFLrxw6VtQ agent
debug1: Will attempt key: $HOME/.ssh/id_rsa_net explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<
[email protected],
[email protected],
[email protected],
[email protected],
[email protected],
[email protected],
[email protected],
[email protected],
[email protected],
[email protected],
[email protected],ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key:
[email protected] RSA SHA256:eQ5AqN8Y+p9cGo8eVzcxOMmJgDN3ivpCbcgA7jkkXeI agent
debug1: Server accepts key:
[email protected] RSA SHA256:eQ5AqN8Y+p9cGo8eVzcxOMmJgDN3ivpCbcgA7jkkXeI agent
Authenticated to
github.com (via proxy) using "publickey".
debug1: pkcs11_del_provider: called, provider_id = (null)
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: filesystem full
debug1: client_input_global_request: rtype
[email protected] want_reply 0
debug1: client_input_hostkeys: searching /home/umze/.ssh/known_hosts for
github.com / (none)
debug1: client_input_hostkeys: searching /home/umze/.ssh/known_hosts2 for
github.com / (none)
debug1: client_input_hostkeys: hostkeys file /home/umze/.ssh/known_hosts2 does not exist
debug1: Sending environment.
debug1: channel 0: setting env XMODIFIERS = "@im=ibus"
debug1: channel 0: setting env LANG = "en_US.UTF-8"
Learned new hostkey: RSA SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
Learned new hostkey: ECDSA SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM
Adding new key for
github.com to /home/umze/.ssh/known_hosts: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
Adding new key for
github.com to /home/umze/.ssh/known_hosts: ecdsa-sha2-nistp256 SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM
debug1: update_known_hosts: known hosts file /home/umze/.ssh/known_hosts2 does not exist
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi net! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3564, received 3176 bytes, in 0.7 seconds
Bytes per second: sent 5290.0, received 4714.1
debug1: Exit status 1
```
字数限制, 另起一个回复