Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
除非使用google开发控制台ssh,否则无法将ssh连接到服务器_Ssh_Debian_Gcloud - Fatal编程技术网

除非使用google开发控制台ssh,否则无法将ssh连接到服务器

除非使用google开发控制台ssh,否则无法将ssh连接到服务器,ssh,debian,gcloud,Ssh,Debian,Gcloud,我无法从我的计算机ssh到托管在谷歌云上的服务器 我尝试了正常的ssh-keygenuser@domain.com上传公钥,上次有效,但这次无效。问题是在我更改帐户密码后开始的。在那之后,我再也不能ssh或sftp到帐户中,尽管我直到断开连接才断开连接 然后我尝试了gcloudsshuser@instance它运行良好,告诉我它还没有繁殖 我将AllowUsers user添加到服务器的ssh配置文件中,并在服务器上重新启动了ssh,但结果仍然相同 以下是错误: Permission denie

我无法从我的计算机ssh到托管在谷歌云上的服务器

我尝试了正常的ssh-keygenuser@domain.com上传公钥,上次有效,但这次无效。问题是在我更改帐户密码后开始的。在那之后,我再也不能ssh或sftp到帐户中,尽管我直到断开连接才断开连接

然后我尝试了gcloudsshuser@instance它运行良好,告诉我它还没有繁殖

我将
AllowUsers user
添加到服务器的ssh配置文件中,并在服务器上重新启动了ssh,但结果仍然相同

以下是错误:

Permission denied (publickey).
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].

更新:

我一直在与谷歌技术支持部门合作,这个问题仍然无法解决。一个名为
authorized_keys
权限的文件在引导时不断被更改为另一个用户,我也无法以其身份登录

所以我把它改成:

thisUser:www-data 755 
但开机时会将其更改为:

otherUser:otherUser 600

要解决这个问题,有两个方法。您可以利用GCE中的元数据功能,添加一个启动脚本,自动更改权限

  • 从开发者控制台,转到您的实例>元数据添加一对键/值

    启动脚本

    valuechmod 755/home/your_user/.ssh/authorized_keychmod 755~/.ssh

  • 重新启动后,应进一步检查该页面下方的串行输出选项,查看它是否在启动时运行。它应该向您展示以下内容:

    在元数据中找到启动脚本

    startupscript:Running startup script/var/run/google.startup.script

  • 可以找到更多信息


    希望有帮助

    我通过删除VM设置中自定义元数据下的现有ssh密钥解决了这个问题。然后我就可以登录ssh了