1: 登录服务器,切换到root用户,命令:sudo su
[chiuci2016@instance-3 ~]$ sudo su
2: 修改ssh配置文件
[root@instance-3 chiuci2016]# vim /etc/ssh/sshd_config
修改下面两个参数把no改为yes
PermitRootLogin no
PasswordAuthentication no
3: 重启ssh服务使修改生效
debain命令:/etc/init.d/ssh restart
centos命令:service sshd restart
4: 给root账户添加密码
命令:passwd root
来源:https://www.cnblogs.com/osker/p/12018263.html