当我使用 SecureCRT 时,它会起作用
[liweizhou@jump:~]$ ssh 101.226.185.80 -v
OpenSSH_7.2p2, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 1: Applying options for *
debug1: Connecting to 101.226.185.80 [101.226.185.80] port 32200.
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/liweizhou/.ssh/id_rsa type -1
...
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu3
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 101.226.185.80:32200 as 'liweizhou'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:lsqj2hG8/Kgw7H+ZrSkfp0EwGZwUv0LjJW4rYauPRtc
debug1: Host '[101.226.185.80]:32200' is known and matches the RSA host key.
debug1: Found key in /home/liweizhou/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering DSA public key: dw_liweizhou
debug1: Server accepts key: pkalg ssh-dss blen 434
debug1: Authentication succeeded (publickey).
Authenticated to 101.226.185.80 ([101.226.185.80]:32200).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: exec
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: X11 forwarding requested but DISPLAY not set
debug1: Requesting authentication agent forwarding.
Last login: Wed Jul 17 11:20:36 2019 from 5.37.7.23
但是当我使用 MobaXterm 时,会出现权限被拒绝(公钥)的情况
[liweizhou@jump:~]$ ssh 101.226.185.80 -v
OpenSSH_7.2p2, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 1: Applying options for *
debug1: Connecting to 101.226.185.80 [101.226.185.80] port 32200.
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/liweizhou/.ssh/id_rsa type -1
...
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu3
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 101.226.185.80:32200 as 'liweizhou'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:lsqj2hG8/Kgw7H+ZrSkfp0EwGZwUv0LjJW4rYauPRtc
debug1: Host '[101.226.185.80]:32200' is known and matches the RSA host key.
debug1: Found key in /home/liweizhou/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/liweizhou/.ssh/id_rsa
debug1: Trying private key: /home/liweizhou/.ssh/id_dsa
debug1: Trying private key: /home/liweizhou/.ssh/id_ecdsa
debug1: Trying private key: /home/liweizhou/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
我该怎么办,我更喜欢使用 MobaXterm
答案1
看来 mobaxterm 正在查看密钥的标准位置:
debug1: Trying private key: /home/liweizhou/.ssh/id_rsa
debug1: Trying private key: /home/liweizhou/.ssh/id_dsa
debug1: Trying private key: /home/liweizhou/.ssh/id_ecdsa
debug1: Trying private key: /home/liweizhou/.ssh/id_ed25519
也许您的密钥不在这些位置之一,并且您已在 secureCRT 中手动加载它,或者它正在通过其他方式发现密钥。
我将在 mobaxterm 中选择密钥,以便它会为该连接加载它。