skip to content
苍狗苍狗Blog

利用 Cloud-init 预加载脚本来开启 root 账号密码登录!

/ 1 min read

此脚本适用于AWS EC2,lightsail,GCP,Azure,scaleway等。

#!/bin/bash
echo root:Cangdog |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

启动实例之后请尽快修改。