Step1: 修改root登录权限
su 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
Step2: 重启ssh服务
sudo service ssh restart
sudo service sshd restart
Step3: 添加root用户密码
sudo passwd root
Step4: 删除root用户ssh连接限制否则会出现报错-Please login as the user "ubuntu" rather than the user "root";
sudo vi /root/.ssh/authorized_keys
删除ssh-前面的内容
Top comments (0)