在指示错误(255)的几秒钟空闲后,我不断被我的计算引擎实例踢出.我使用'gcloud compute ssh'登录.我使用的是默认的防火墙设置,我认为这对ssh来说已经足够了.但是,如果我遗漏了某些内容,请指出并建议修复此错误.基本上我不能在这一点上完成任何有效的工作,不得不多次ssh.
提前致谢.
Anh-
Agi*_*ean 33
如果设置发生更改,gcloud会拒绝ssh连接,例如,在您更改默认区域或区域之后,或者您创建了另一个实例.然后,您必须更新元数据中的ssh密钥
sudo gcloud compute config-ssh
Run Code Online (Sandbox Code Playgroud)
如果这会抱怨配置文件中存储ssh密钥条目的不同条目,〜/ .ssh/config,请删除此文件并再次执行上述命令.
MrK*_*mar 14
对于那些在此页面停留的人。这帮助我解决了这个问题。尝试以下操作:
再次运行 gcloud 命令
这似乎是 Google Cloud Platform 本身的一个功能/问题,我们将继续检查它。
小智 13
255是ssh失败的交互式ssh退出代码 - 否则交互式ssh退出,并在ssh会话中执行最后一个命令的退出代码.
下次从ssh获得退出代码255时,请尝试使用--ssh-flag =" - vvv"运行(更多v = =更多调试输出),看看它是否有助于追踪连接问题.
如果编辑了默认网络,或者不使用默认网络,您可能需要通过添加防火墙规则来显式启用 ssh 访问:
$ gcloud compute firewall-rules create --network=YOUR_NETWORK \
default-allow-ssh --allow tcp:22
Run Code Online (Sandbox Code Playgroud)
之后,重试“gcloudcomputessh”命令。
小智 6
This is a real problem with very little documentation to dealing with it.
Sometime after creating the instance using the gcloud sdk ssh snippet provided via GCP console stopped working and continually errors with 255 making connecting to ssh on the instance only available through browser via GCP console for the compute instance in question. Not to mention this has happened to me on many different instances some without touching the default account permissions after initial setup and deployment which is overly frustrating. Cause for no reason it just stops working...works, then doesn't...
The only thing that worked for me was creating a new user to connect with through gcloud sdk! Be it Windows/PowerShell or Linux locally, using the following snippet:
gcloud compute ssh newuser-name@instance-name
That all per GCP documentation here: https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-ssh
根据文档中的建议,其他所有内容都通过了 - 端口 22 打开并具有访问权限,这意味着它必须是默认用户授权密钥的问题,他们绝对没有提供有关如何修复该问题的文档 - 至少我找不到修复的任何内容(不是创建或删除)
我尝试更新帐户,尝试从实例中删除用户和凭据,但似乎没有任何效果。使用:
gcloudcompute--project“项目名称”ssh--zone“us-east4-a”“实例名称”
只是不起作用... - 甚至尝试了“gcloudcomputeconfig-ssh --force-key-file-overwrite”也没有用...
但是创建新用户每次都有效,并且一旦创建用户,您就可以通过 gcloud sdk 继续使用该用户
这是一个解决办法,我讨厌这样的事情,但为了我的理智,这至少在我能弄清楚如何重置默认帐户权限之前是有效的,所以如果有人有任何想法或者可以为我指出一个方向我会非常感激!
| 归档时间: |
|
| 查看次数: |
34490 次 |
| 最近记录: |