此脚本适用于AWS EC2,lightsail,GCP,Azure,scaleway等。
#!/bin/bash
echo root:iDonglei |sudo chpasswd 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;
sudo service sshd restart
密码为:iDonglei
启动实例之后请尽快修改。