You've successfully subscribed to The Daily Awesome
Great! Next, complete checkout for full access to The Daily Awesome
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

折腾 | 记录一次网站宕机 | 谷歌云 SSH故障

. 1 min read

谷歌云实例使用项目防火墙管理,不需要在系统中开启防火墙

若误开启并导致无法ssh连接,可以串行连接实例。

若未设置密码,可以使用启动脚本的方式新建sudoer用户

向元数据中增加

键:startup-script,

值:

#! /bin/bash 
useradd -G sudo <user> 
echo '<user>:<passwd>' | chpasswd

后即可登陆串行控制台,关闭防火墙即可。

记得完成设置后关闭串行控制台权限。

检测端口状态

VM:~$ nc -vz <domain | ip> 22
Connection to <domain | ip> 22 port [tcp/ssh] succeeded!
VM:~$ nc -vz <domain | ip> 80
Connection to <domain | ip> 80 port [tcp/http] succeeded!
VM:~$ nc -vz <domain | ip> 443
Connection to <domain | ip> 443 port [tcp/https] succeeded!

若出现网站访问 504 错误,说明由于更换 ip 导致的远程数据库拒绝访问,更新权限即可。