VPS 获取root方法

执行以下代码重启即可

第一:逐一运行如下命令,密码***fdd641ecfd1FS自己设置一下

sudo -i
echo root:***fdd641ecfd1FS |sudo chpasswd root
sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;
sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
sudo service sshd restart

然后重启,即可使用root和你设置的密码进行登录了。

发表回复