问题:root无法ssh登录Ubuntu服务器?
原因:Ubuntu系统默认禁止root用户ssh登录
解决方案:修改sshd服务配置文件,vim /etc/ssh/sshd_config
找到这一行, #PermitRootLogin prohibit-password
然后添加 PermitRootLogin yes 保存退出文件。
("PermitRootLogin” 设置是否允许root通过ssh登录。实际生产环境里是设成 "no" 哈)
然后重启服务,service sshd restart 或者 systemctl restart sshd 都可以。重新打开Xshell新的连接可以使用root用户正常远程ssh登录。
需要注意的是配置文件是 sshd_config 不是 ssh_config,注意区分哈亲。
ssh_config 和sshd_config都是ssh服务器的配置文件,区别在于,ssh_config对于客户端的配置文件,而sshd_config 则是针对服务端的配置文件。