我已经生成了一对 rsa 密钥,并使用它通过 ssh 进入我的服务器,无需密码。服务器包含文件~/.ssh/authorized_keys
,我将客户端的文件复制到该文件中~/.ssh/id_rsa.pub
,如下所示:
ssh-rsa AAAAB3NzaC1yc2wqegqeweqrwqgwqet......iCA2unoYGtLgS7F8veyKl85jJwdZpwqhCXnkei4gq+ABZm7STs/7ns= [email protected]
但是,按如下方式 ssh 后,我得到了以下信息:
my-shell ~ % ssh -Yvv prikshet@proto1
OpenSSH_8.1p1, LibreSSL 2.7.3
...
...
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /Users/prikshetsharma/.ssh/id_rsa RSA SHA256:AFKLy9UvmEcUzpn1Ub4aUjqVPJJL1Zri8KWDtJARXL8
debug1: Will attempt key: /Users/prikshetsharma/.ssh/id_dsa
debug1: Will attempt key: /Users/prikshetsharma/.ssh/id_ecdsa
debug1: Will attempt key: /Users/prikshetsharma/.ssh/id_ed25519
debug2: pubkey_prepare: done
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/prikshetsharma/.ssh/id_rsa RSA SHA256:AFKLy9UvmEcUzpn1Ub4aUjqVPJJL1Zri8KWDtJARXL8
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/prikshetsharma/.ssh/id_dsa
debug1: Trying private key: /Users/prikshetsharma/.ssh/id_ecdsa
debug1: Trying private key: /Users/prikshetsharma/.ssh/id_ed25519
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
服务器仍在要求输入密码。服务器~/.ssh/authorized_keys
权限如下:
my_shell~$ sudo ls -lah ~/.ssh/authorized_keys
[sudo] password for prikshet:
-rw------- 1 root root 595 Sep 11 18:03 /home/prikshet/.ssh/authorized_keys
为什么服务器仍要求输入密码?