gcp_root_ssh.sh 410 B

12345678910111213141516
  1. #!/bin/bash
  2. # Google Cloud Platform GCP实例开启密码与root用户登陆
  3. # GCP一键启用root帐号命令
  4. # wget -qO- git.io/fpQWf | bash
  5. # 修改root 密码
  6. passwd
  7. # GCP 启用root密码登陆
  8. sed -i "s/PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config
  9. sed -i "s/PasswordAuthentication.*/PasswordAuthentication yes/g" /etc/ssh/sshd_config
  10. # 重启ssh服务
  11. systemctl restart ssh