1.转到 Google Cloud 控制台中的防火墙页面。
2.点击创建防火墙规则。
输入防火墙规则的名称。 该名称在项目中必须是唯一的
优先级写 1,
目标:网络中的所有实例
流量方向,入站
对匹配项执行的操作,允许
来源 IP 地址范围,0.0.0.0/0
协议和端口,全部允许
如下截图
3.点击创建。
1.在 Google Cloud 控制台中,前往虚拟机实例页面。
2.在 网络 那里的 网络标记 那里写上刚才创建的防火墙规则名称。
3.点击创建实例。
1.先选择从浏览器打开 ssh 连接服务器
2.切换到 root 账号
sudo -i
3.设置 root 密码
passwd
4.开启SSH服务
¶ CentOS 和 Debian 通用,输入以下两条命令
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 系统,输入以下两条命令
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
5.重启 SSH 服务
service sshd restart
Get udpated with news, tips & tricks