1.切换 root 用户sudo -i2.设置 root 密码passwd3.开启 root 登录与密码认证sed -i s/^#PermitRootLogin.*/PermitRootLogin yes/ /etc/ssh/sshd_config sed -i s/^PasswordAuthentication.*/PasswordAuthentication yes/ /etc/ssh/sshd_config4.重启 SSH 服务systemctl restart sshd5.完成后直接用root 你设置的密码SSH 登录即可。service ssh restart