给Ubuntu设置root用户并且可以SSH登录
设置root密码
ubuntu@VM-58-46-ubuntu:~$ sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
ubuntu@VM-58-46-ubuntu:~$ su root
Password:
root@VM-58-46-ubuntu:/home/ubuntu# su ubuntu修改etc/ssh/sshd_config
# Authentication:
LoginGraceTime 120
(#)PermitRootLogin prohibit-password
PermitRootLogin yes
StrictModes yes注释掉PermitRootLogin prohibit-password 添加PermitRootLogin yes
重启SSH:
root@VM-58-46-ubuntu:/# vi etc/ssh/sshd_config
注意:修改文件时要root权限