操作步骤
1. 打开AWS管理控制台:https://ap-southeast-1.console.aws.amazon.com/ec2/home?region=ap-southeast-1#Home 在选择服务器地区后,点击”启动实例”(Launch Instances)按钮。

2. 在”Amazon Machine Image (AMI)”步骤中,选择Amazon Linux、Ubuntu 或 Debian 系统。

3. 展开”高级详细信息” 拉到最下方”用户数据”的地方复制以下shell脚本,参考所选系统选择
- 当您选择 Amazon Linux 或 Debian 系统时,复制以下脚本
#!/bin/bash # 启用 SSH 密码验证 sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak$(date +%Y-%m-%d-%H%M%S) && sudo sed -i '/#PermitRootLogin prohibit-password/a PermitRootLogin yes PasswordAuthentication yes' /etc/ssh/sshd_config && sudo systemctl restart sshd && sudo service ssh restart # 设置 root 用户密码 # 其中"TWeDb4reZBKxapfqzffg"可改为自定义密码 echo "root:TWeDb4reZBKxapfqzffg" | sudo chpasswd
- 当您选择 Ubuntu 系统时,复制以下脚本
#!/bin/bash
# 启用 SSH 密码验证
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak$(date +%Y-%m-%d-%H%M%S) && sudo sed -i '/#PermitRootLogin prohibit-password/a PermitRootLogin yes
PasswordAuthentication yes' /etc/ssh/sshd_config && sudo systemctl restart sshd
# 允许密码登录
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config.d/60-cloudimg-settings.conf
# 设置 root 用户密码
# 其中"TWeDb4reZBKxapfqzffg"可改为自定义密码
echo "root:TWeDb4reZBKxapfqzffg" | sudo chpasswd


🚀 延伸推荐:91CLOUD 云服务
如果你在使用 AWS EC2 的过程中,需要:
- ✅ 匿名注册 AWS 账号
- ✅ 支持 USDT、对公美元付款
- ✅ 多云服务(AWS / GCP / 阿里云国际 / 华为云)一站式解决方案
- ✅ 成本优化与技术支持
欢迎访问 👉 91CLOUD 官网 获取更多支持。