AWS中的lightsail创建root进行登陆

森活哥 299
#!/bin/bash
echo root:123456 |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

新建lightsail的机子,然后输入上方的自定义ssh。开启后就有账号:root;密码:123456

分享