linux下ssh无法连接的原因

在虚拟机上安装了ubuntu16.04 server,用本机 ssh 连接的时候 无法连接上;

忽然想起在安装的时候有个openssh好像没有勾选,所以在虚拟机上

apt install openssh-server;

现在可以连接上了,但是在输入root密码的时候验证不通过,在安装的时候我创建了一个普通用户,ssh 用普通用户可以连接上;

我就在想是不是openssh禁止ssh  root用户;找到openssh的配置文件;

vim /etc/ssh/sshd_config

找到这一行

PermitRootLogin prohibit_password

改为:

PermitRootLogin yes

最后重启ssh服务

/etc/init.d/ssh restart
原文地址:https://www.cnblogs.com/codeAB/p/6395087.html