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
Ssh 无法访问Google Compute虚拟机_Ssh_Google Compute Engine - Fatal编程技术网

Ssh 无法访问Google Compute虚拟机

Ssh 无法访问Google Compute虚拟机,ssh,google-compute-engine,Ssh,Google Compute Engine,我无法使用Mac上的终端和谷歌提供的浏览器SSH访问谷歌虚拟机 在终端上,它给了我错误(当我运行sudo gcloud compute ssh instance name时): 权限被拒绝(公钥) 当我尝试浏览器SSH时,它会说: 无法连接,正在重试。 到目前为止,我一直在尝试: 从云控制台中删除了项目的所有SSH密钥 已从我的系统中删除SSH密钥 使用gcloudinit 运行sudo gcloud compute ssh instance name,它创建了一个新的ssh密钥,并将该密钥更新

我无法使用Mac上的终端和谷歌提供的浏览器SSH访问谷歌虚拟机

在终端上,它给了我错误(当我运行sudo gcloud compute ssh instance name时): 权限被拒绝(公钥)

当我尝试浏览器SSH时,它会说: 无法连接,正在重试。

到目前为止,我一直在尝试:

  • 从云控制台中删除了项目的所有SSH密钥

  • 已从我的系统中删除SSH密钥

  • 使用gcloudinit

  • 运行sudo gcloud compute ssh instance name,它创建了一个新的ssh密钥,并将该密钥更新为项目密钥

  • 但它仍然给出了同样的错误


    请提供帮助。

    如果您从Windows计算机连接到VM,您的Windows用户名必须仅包含英文字符。我在更改windows配置文件时遇到了这样一个问题,它已被修复。

    这里有一个对我有效的替代方法:

    创建SSH密钥 在终端类型
    ssh-keygen-t rsa-f~/.ssh/{filename}-C{username}

    将公钥上载到您的VM

  • 在终端类型
    cat~/.ssh/{filename}.pub
  • 将结果复制到剪贴板
  • 回到谷歌云的控制台:点击你的实例名称
  • 单击“编辑”
  • 向下滚动至“SSH”
  • 其中显示“输入整个关键数据:粘贴
  • 拯救
  • 通过终端连接 键入
    ssh-i~/.ssh/{filename}.ppk{username}@{ip address}