我可以使用 autossh 进行 gcloudcompute ssh 吗?

bra*_*nes 1 ssh google-compute-engine gcloud autossh

由于某种原因,ssh无法设置通往我的 Google Compute Engine 实例的隧道。我必须使用gcloud compute ssh. 我真的很想建立一个持久/弹性的隧道,就像autossh一样。有什么方法可以使用吗gcloud compute ssh

Zac*_*man 5

gcloud compute ssh只需将您的 ssh 密钥复制到项目sshKeys元数据(请参阅Cloud Console > 计算引擎 > 元数据 > SSH 密钥)并使用该密钥运行独立 SSH ~/.ssh/google_compute_engine。要查看调用的确切命令行,请运行gcloud compute ssh --dry-run ...。典型 SSH 可以实现的任何功能都可以通过gcloud compute ssh.

另一个要研究的选项是gcloud compute config-ssh将您的 SSH 密钥同步~/.ssh/google_compute_engine到项目并设置您的~/.ssh/config文件,以便您可以在ssh没有gcloud.