ssh authentication魔鬼细节--.ssh文件夹权限

换到7后出现莫名奇妙问题,ssh验证始终不起作用。

服务器

centos7#mkdir ~/.ssh
centos7#touch ~/.ssh/authorized_keys
centos7#chmod 600 ~/.ssh/authorized_keys

客户端

client$ssh-copy-id 'root'@xxx.xxx.xxx.xxx

结果反复都需要输入密码,用

client$ssh -v 'root'@'xxx.xxx.xxx.xxx'

 无法定位出原因,看了下官方资料

注意到

$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/id_rsa 

试了下:

centos7#chmod 700 ~/.ssh

再试,通过!

特记录此坑爹细节(貌似在centos6不需要此步)

实际在拷贝公钥时建议使用指令

ssh-copy-id user@host

来源:http://www.cnblogs.com/Tommy-Yu/p/5497246.html

原文地址:https://www.cnblogs.com/Tommy-Yu/p/5497246.html