如果我将主目录的权限更改为 777,并且我的 google 云服务器不再允许我访问,该怎么办

what to do if I change the permissions of my home directories to 777, and my google cloud server no longer gives me access

enter image description here

更改权限后,我没有克服这个错误

很可能您更改了目录 .ssh 的权限。这会破坏 SSH 安全性。您应该能够创建一个启动脚本来将目录 /home/<username>/.ssh 更改为 700.

  • 前往Google Cloud Console

  • 转到计算引擎 -> 虚拟机实例

  • 停止 VM 实例

  • 单击编辑按钮

  • 向下滚动到自定义元数据

    部分
  • 对于密钥输入 startup-script

  • 输入以下值将 <username> 替换为您的用户名:

    #! /bin/bash

    chmod 700 /home/<username>/.ssh

  • 重启实例

另一种方法是使用 VM 串行控制台:

Troubleshooting using the serial console