DEV Community

tingshuai
tingshuai

Posted on • Edited on

新增aws-ubuntu服务器abc

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
Enter fullscreen mode Exit fullscreen mode

Step2: 重启ssh服务

sudo service ssh restart 
sudo service sshd restart
Enter fullscreen mode Exit fullscreen mode

Step3: 添加root用户密码

sudo passwd root
Enter fullscreen mode Exit fullscreen mode

Step4: 删除root用户ssh连接限制否则会出现报错-Please login as the user "ubuntu" rather than the user "root";

sudo vi /root/.ssh/authorized_keys 
Enter fullscreen mode Exit fullscreen mode

删除ssh-前面的内容

Top comments (0)