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

2019-09-22 20:29:17 / Codes / 0 Comments

  • 脚本如下:
#!/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




Comments