我是云计算新手,我正在尝试使用 SSH 来控制我的虚拟机实例,但是当我使用命令(带调试)时
gcloud compute ssh my-instance-name --verbosity=debug
显示错误
DEBUG: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255]. Traceback (most recent call last): File "/google/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 983, in Execute resources = calliope_command.Run(cli=self, args=args) File "/google/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 784, in Run resources = command_instance.Run(args) File "/google/google-cloud-sdk/lib/surface/compute/ssh.py", line 262, in Run return_code = cmd.Run(ssh_helper.env, force_connect=True) File "/google/google-cloud-sdk/lib/googlecloudsdk/command_lib/util/ssh/ssh.py", line 1256, in Run raise CommandError(args[0], return_code=status) CommandError: [/usr/bin/ssh] exited with return code [255]. ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
我尝试解决此链接中的问题,但不起作用 https://groups.google.com/forum/#!topic/gce-discussion/O-c10TM4ZLM
最佳答案
SSH 错误代码 255 是 GCP 返回的一般错误。您可以尝试以下选项之一。
<强>1。等待几分钟,然后重试。有可能:
实例尚未完成启动。
SSH key 的元数据尚未完成传播到项目或实例。
- 访客环境尚未读取 SSH key 元数据。
<强>2。验证对实例的 SSH 访问未被防火墙阻止。
gcloud compute firewall-rules list | grep "tcp:22"
如有必要,创建防火墙规则以允许给定 VPC 网络、子网或实例标记使用 TCP 22。
gcloud compute firewall-rules create ssh-allow-incoming --priority=0 --allow=tcp:22 --network=[VPC-Network]
<强>3。确保根卷没有磁盘空间不足。类似以下的消息将在 console log 中可见当磁盘空间不足时:
...No space left on device...
...google-accounts: ERROR Exception calling the response handler. [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/']...
<强>4。确保实例内存未耗尽
<强>5。验证临时 SSH key 元数据是否设置为 project或instance .
最后你可以关注他们的任何一个supported或third-party方法
关于linux - 控制台上的 SSH 谷歌云权限被拒绝(公钥),并出现 google-cloud-sdk 文件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58546005/