亚马逊AWS EC2上Debian系统使用root用户登录-无需秘钥–开机自动配置脚本

如果使用了Debian系统,那么开机前输入如下脚本,就可以设定为密码方式登录EC2了。 Centos和ubuntu 不能使用这个方法


#!/bin/bash
sudo sed -i ‘s/^.*PermitRootLogin.*/PermitRootLogin yes/g’ /etc/ssh/sshd_config
sudo sed -i ‘s/^.*PasswordAuthentication.*/PasswordAuthentication yes/g’ /etc/ssh/sshd_config
echo root:Password123@ | sudo chpasswd
sudo service ssh restart


 

Scroll to Top