linux系统使用cloud-init脚本开启root账号密码登录

脚本如下:

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

默认密码是:Joker

Joker ·
评论 · 首页 订阅