用Xshell root连接时显示ssh服务器拒绝了密码,应该是应该是sshd的设置不允许root用户用密码远程登录
修改 /etc/ssh/sshd_config文件,注意,安装了openssh才会有这个文件,如果文件不存在请检查是否安装了openssh。
vim /etc/ssh/sshd_config
找到
# Authentication: LoginGraceTime 120 PermitRootLogin prohibit-password
StrictModes yes
改成
# Authentication: LoginGraceTime 120 PermitRootLogin yes StrictModes yes
然后输入命令
/etc/init.d/ssh restart
重启ssh服务即可。
上面并没有什么用。
vi /etc/ssh/ssd_config PasswordAuthentication yes 然后重启sshd服务然后重启服务就可以了。
systemctl restart ssh
相关知识了解:
如果你使用密钥登陆不上,需要注意权限: 1).ssh目录是700权限; 2)authorized_keys公钥是400权限 3)用ssh连接用的私钥是600权限
sshd_config配置 详解