仅使用 authorized_keys 进行 ssh 登录,无需私钥或密码

仅使用 authorized_keys 进行 ssh 登录,无需私钥或密码

我正在尝试了解单独ssh使用authorized_keys(即不使用本地私钥)。这是我到目前为止所做的。

  1. 使用通常的方法创建本地公钥+私钥ssh-keygen -t rsa
  2. 将公钥复制到authorized_keys远程机器。
  3. 我删除了本地机器上的公钥和私钥。

我可以成功登录远程计算机,无需任何密码或私钥。我无法确定提供的是哪个公钥或密钥位于何处。

我试图了解在我的情况下身份验证是如何发生的。

这是 的输出ssh -v

(base) xxxx@r-23-105-25-172 XXXX Summer 2021 % ssh -v [email protected]
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/xxxx/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: /etc/ssh/ssh_config line 51: Applying options for *
debug1: Connecting to xxxx.xxxx.edu.sg port 22.
debug1: Connection established.
debug1: identity file /Users/xxxx/.ssh/id_rsa type -1
debug1: identity file /Users/xxxx/.ssh/id_rsa-cert type -1
debug1: identity file /Users/xxxx/.ssh/id_dsa type -1
debug1: identity file /Users/xxxx/.ssh/id_dsa-cert type -1
debug1: identity file /Users/xxxx/.ssh/id_ecdsa type -1
debug1: identity file /Users/xxxx/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/xxxx/.ssh/id_ed25519 type -1
debug1: identity file /Users/xxxx/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/xxxx/.ssh/id_xmss type -1
debug1: identity file /Users/xxxx/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to xxxx.xxxx.edu.sg:22 as 'xxxx'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: aes256-ctr MAC: hmac-sha1 compression: none
debug1: kex: client->server cipher: aes256-ctr MAC: hmac-sha1 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:GxTuRA57OBBU6fmXjFwVCSzfadJps3WqmvkPMulr+fo
debug1: Host 'xxxx.xxxx.edu.sg' is known and matches the ECDSA host key.
debug1: Found key in /Users/xxxx/.ssh/known_hosts:9
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:01e48aRr8gQiUtaLrKj5O9qSmfadlMXHiTcbdzoS+LQ agent
debug1: Will attempt key: /Users/xxxx/.ssh/id_rsa
debug1: Will attempt key: /Users/xxxx/.ssh/id_dsa
debug1: Will attempt key: /Users/xxxx/.ssh/id_ecdsa
debug1: Will attempt key: /Users/xxxx/.ssh/id_ed25519
debug1: Will attempt key: /Users/xxxx/.ssh/id_xmss
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,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: [email protected] RSA SHA256:01e48aRr8gQiUtaLrKj5O9qSmfadlMXHiTcbdzoS+LQ agent
debug1: Server accepts key: [email protected] RSA SHA256:01e48aRr8gQiUtaLrKj5O9qSmfadlMXHiTcbdzoS+LQ agent
debug1: Authentication succeeded (publickey).
Authenticated to xxxx.xxxx.edu.sg ([xxxx]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending environment.
debug1: Sending env LC_TERMINAL_VERSION = 3.4.12
debug1: Sending env LC_CTYPE = UTF-8
debug1: Sending env LC_TERMINAL = iTerm2

我无法弄清楚这个公钥在我的本地机器上位于哪里?Will attempt key: [email protected] RSA SHA256:01e48aRr8gQiUtaLrKj5O9qSmfadlMXHiTcbdzoS+LQ agent

相关内容