Amazon Lightsail 启用 root 登录 SSH 功能

在创建实例的“启动脚本”中输入以下指令:

echo root:password |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 reboot

替换 password 为你自己的密码即可。成功创建实例以后就可以使用 root 和密码直接登录 SSH 了。