https://blog.csdn.net/xexiyong/article/details/77742994

 

 


前段时间将客户端的id_rsa.pub添加到服务器的authorized_keys中,可是ssh登录依然要输入密码。
今天试着修复了此问题。

1 在服务器端运行以下命令:
tail -f /var/log/secure
在终端显示登录日志 http://linux.vbird.org/linux_basic/0570syslog.php

2 在客户端用ssh登录

3 到服务器端查看终端,看到这么一条日志:
bad ownership or modes for file XXX/authorized_keys

到网上搜了下,原因是:
SSH会检查你用户home或~/.ssh目录的权限,这些目录只应该你自己有写权限,不应有组写权限。

4 解决办法:

chmod g-w /home/your_user
chmod 700 /home/your_user/.ssh
chmod 600 /home/your_user/.ssh/authorized_keys

5 方法二:
修改ssh_config文件,设置StrictModes为off

发表评论

电子邮件地址不会被公开。