Explorar o código

Create gcp_root_ssh.sh

蘭雅sRGB %!s(int64=6) %!d(string=hai) anos
pai
achega
946a356ac0
Modificáronse 1 ficheiros con 14 adicións e 0 borrados
  1. 14 0
      gcp_root_ssh.sh

+ 14 - 0
gcp_root_ssh.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+
+#  Google Cloud Platform  GCP实例开启密码与root用户登陆
+#  
+
+# 修改root 密码
+passwd
+
+# GCP 启用root密码登陆
+sed -i "s/PermitRootLogin.*/PermitRootLogin yes/g"   /etc/ssh/sshd_config
+sed -i "s/PasswordAuthentication.*/PasswordAuthentication yes/g"   /etc/ssh/sshd_config
+
+# 重启ssh服务
+systemctl restart ssh