# **两种本地客户端登录 Google Cloud 的方法:**

1.开启谷歌云 Root 账户密码使用本地 SSH 客户端登录。

2.通过 Google Cloud SSH 密钥使用 XShell 客户端登录。

默认谷歌是通过 GCloud 命令在浏览器窗口访问 SSH 控制台的,它是这样实现的:

1
gcloud beta compute --project "Project Name" ssh --zone "VM Zone" "VM ID"

但是我们一般都习惯了用本地客户端登录 SSH,而有时候一些操作本地直接登录的确更方便,开启本地登录还是很有必要的,不过我建议第二种方法,因为开了 Root 账户密码后会让 Hacker 对你的实例更有机可乘。

I.开启谷歌云 Root 账户密码使用本地 SSH 客户端登录

方法一:

  • 网页打开 Google SSH 控制台连接到实例,并切换到 Root 账户:
1
sudo -i
  • 打开SSH配置文件:
1
vi /etc/ssh/sshd_config
  • i 进入 INSERT 模式后找到并修改以下两行:
1
2
PermitRootLogin yes
PasswordAuthentication yesCopy
  • 保存并退出:
1
:wq
  • 设置 Root 登录密码:
1
passwd root
  • 重启 SSH 服务后就可以直接用 Root 账户登录了:
1
2
3
service sshd restart
# or
systemctl restart sshdCopy

方法二:

CentOS和Debian通用,输入以下两条命令

1
2
sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config

Ubuntu系统,输入以下两条命令

1
2
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config

重启服务器

1
reboot

II.通过 Google Cloud SSH 密钥使用 XShell 客户端登录

  • XShell 菜单栏 -> 工具 -> 新建用户密钥生成向导:

img
img

  • 保存好你的公钥以便待会使用

img

  • 添加 SSH 密钥到 Google Cloud:

img

  • 粘贴你刚才生成的密钥,并在后面加上你密钥生成时设置的用户名然后保存。

img

  • 使用 XShell 连接测试

img
img

如果登录成功你可以使用 sudo -i 切到 Root 账户,请保存好你的密钥信息,如果不慎丢失也没关系,删除谷歌云上你刚才创建的 SSH 密钥根据操作重新创建一个即可。我比较推荐这种安全登录方法,没有涉及到登录密码信息,也不需要你输入,除非 Hacker 有你的 SSH 密钥证书,不然几乎没有可能破解你的 SSH 登录权限。

谷歌云开启本地 SSH 工具 Root 用户登录权限 - Cee

常用脚本命令

升级系统

1
sudo apt update && sudo apt upgrade

安装curl

1
sudo apt install curl

1
sudo apt-get install curl

安装wget

  • yum安装

1
yum -y install wget

在Ubuntu /Debian平台上安装wget

  • 要在Ubuntu / Debian发行版上安装wget ,请以root用户身份通过SSH登录并运行命令。
    apt-get install wget
  • 要确认安装了wget工具,请运行命令:
    dpkg -l | grep wget

工具箱

1
wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && ./box.sh

WARP

1
wget -N --no-check-certificate https://raw.githubusercontent.com/YG-tsj/Oracle-warp/main/multiV464.sh && chmod +x multiV464.sh && ./multiV464.sh

MPROTO

1
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/mtproxy.sh && chmod +x mtproxy.sh && bash mtproxy.sh