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

2021-10-19 Note 2,563

此脚本适用于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

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

发布评论

© iDongLei All Rights Reserved 浙ICP备2021013583号-5

Huaweicloud 强力驱动 / RunTime Day / Files / Status / About / XML