gcp_root_ssh.sh 345 B

1234567891011121314
  1. #!/bin/bash
  2. # Google Cloud Platform GCP实例开启密码与root用户登陆
  3. #
  4. # 修改root 密码
  5. passwd
  6. # GCP 启用root密码登陆
  7. sed -i "s/PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config
  8. sed -i "s/PasswordAuthentication.*/PasswordAuthentication yes/g" /etc/ssh/sshd_config
  9. # 重启ssh服务
  10. systemctl restart ssh