1. 设置root密码
$ sudo passwd root
根据提示输入密码
2. 切换到root用户
$ su - root
根据提示输入密码
3. 编辑 sshd_config
# vi /etc/ssh/sshd_config
原配置(我这是centos7的默认配置)
#PermitRootLogin yes
PasswordAuthentication no
修改后:
PermitRootLogin yes
PasswordAuthentication yes
4.重启sshd服务
service sshd restart
或
systemctl restart sshd.service
本文出现任何错误,请留言批评指正。