tingshuai
Posted on February 22, 2024
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-前面的内容
💖 💪 🙅 🚩
tingshuai
Posted on February 22, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
aws Say Goodbye to SSH: Securing Your AWS Environment with EC2 Instance Connect Endpoint
November 18, 2024
aws Say Goodbye to SSH: Securing Your AWS Environment with EC2 Instance Connect Endpoint
November 18, 2024