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)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay