有的时候传送密钥后怎么调试都不行,比如修改chmod 600 id_rsa ,还有 chmod 700 ~/.ssh ,当然这两个是必须的,普通用户没有~/.ssh 需要手动创建就必须修改为700的权限。
还有配置文件添加开启
RSAAuthentication yes
PubkeyAuthentication yes
然后重启systemctl restart sshd
这些做过后依然不行,原因在于你ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
得到的是让你用
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.
实则需要指定自身私钥登陆:ssh -i ~/.ssh/id_rsa [email protected]