1、连接到用服务器,在登陆的界面中输入登录账户,输入登陆密码,点击回车。
2、登陆进去后,切换root
sudo -i
3.设置密码
passwd
4.依次执行如下代码:
sed -i "s/PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config
sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config
sed -i "s/PasswordAuthentication.*/PasswordAuthentication yes/g" /etc/ssh/sshd_config
5.重启sshd服务
systemctl restart sshd