1.首先创建root的密码
chuxin@ubuntu22:~$ sudo passwd root
[sudo] password for chuxin:
New password:
Retype new password:
passwd: password updated successfully
2.解除密码登录
sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
3、打开密码身份验证
sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
4、重启ssh
sudo systemctl restart ssh