ssh免密登录失效处理
目录
免密登录设置完成了,ssh连接其他服务器能免密成功,但是在某个服务器上一直不成功,每次都必须输入密码
使用 -vvv
查看日志: ssh -vvv 用户@ip # ssh连接时显示日志
debug3: send_pubkey_test
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,password
debug1: Trying private key: /var/lib/jenkins/.ssh/id_dsa
debug3: no such identity: /var/lib/jenkins/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ecdsa
debug3: no such identity: /var/lib/jenkins/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ed25519
debug3: no such identity: /var/lib/jenkins/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
解决方法
A服务器连接B服务器,在B服务器上修改:
# 修改文件
sudo vi /etc/ssh/sshd_config
# 设置StrictModes 为no
#StrictModes yes
StrictModes no
# 重启服务
sudo service sshd restart