这是我做的:
客户: =>使用ssh-keygen -t rsa
=>将 id_rsa.pub 发送到服务器(使用scp)并将其发送到〜/ .ssh / authorized_keys
/ etc / ssh / shd_config中的服务器::
=>取消注释AuthorizedKeysFile%h / .ssh / authorized_keys
=> PasswordAuthentication no
=> UsePAM否
我重新启动了服务器:service sshd restart
问题:当我尝试连接" ssh user@IP_Server -v
"在我把密码短语之后。
我得到以下日志:
Enter passphrase for key '/root/.ssh/id_rsa':
debug3: sign_and_send_pubkey: RSA SHA256:HMjzNl/zNrs...3m6SYDQ64ZoHeL6k
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Trying private key: /root/.ssh/id_dsa
debug3: no such identity: /root/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_ecdsa
debug3: no such identity: /root/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_ed25519
debug3: no such identity: /root/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
您知道这些日志的来源吗?
干杯
答案 0 :(得分:0)
好的,我认为authorized_keys
是一个目录,并将公钥放入其中。但实际上它是一个文件!解决了!