命令“gcloud compute ssh”与“和“ssh” [英] Difference between the commands "gcloud compute ssh" and "ssh"

查看:849
本文介绍了命令“gcloud compute ssh”与“和“ssh”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

gcloud compute ssh comannd与just ssh 命令之间究竟有什么区别?



我做了一个观察,即使如此,我可以使用 gcloud compute ssh 轻松地连接两个实例,但我无法做到这一点 ssh 命令。但是,手动设置ssh密钥后,ssh命令正常工作。但gcloud命令不应该处理密钥管理吗?如果使用gcloud设置了一次,为什么ssh命令无法正常工作?/ b>



工作正常:

  gcloud compute ssh instance_2 
gcloud compute shh instance_1





如果不手动设置ssh-keys,则不起作用:

  ssh instance_2 
shh instance_1



这个问题来自于我的一个不同的问题,这让我坚持了几天: OpenMPI:尝试使用mpirun时权限被拒绝


< gcloud compute ssh将密钥对安装为〜/ .ssh / google_compute_engine [.pub]。

ssh在默认情况下使用〜/ .ssh / identity [.pub]。



您可以将Google密钥对复制到默认名称:

  $ cp〜/ .ssh / google_compute_engine〜/ .ssh / identity 
$ cp〜/ .ssh / google_compute_engine.pub〜/ .ssh / identity.pub

或者您可以指定在调用ssh时使用的私钥:

  $ ssh -i〜/ .ssh / google_compute_engine instance_name 


What exactly is the difference between the gcloud compute ssh comannd and "just" the ssh command?

I made the observation that even so I can easily connect between two instances using gcloud compute ssh, i cannot do it with the ssh command. However, after setting up the ssh-keys manually, the ssh command works fine. But shouldn't the gcloud command handle the key management? And if it is set up one time using gcloud, why is the ssh command not working properly

.

Works fine:

gcloud compute ssh instance_2
gcloud compute shh instance_1

.

Doesn't work without manually setting up the ssh-keys:

ssh instance_2
shh instance_1

.

This question comes from a different problem I had, which drove me nuts for days: OpenMPI: Permission denied error while trying to use mpirun

解决方案

gcloud compute ssh installs the key pair as ~/.ssh/google_compute_engine[.pub]. ssh uses ~/.ssh/identity[.pub] by default.

You can either copy the google key pair to the default name:

$ cp ~/.ssh/google_compute_engine ~/.ssh/identity
$ cp ~/.ssh/google_compute_engine.pub ~/.ssh/identity.pub

or you can just specify the private key to use when you invoke ssh:

$ ssh -i ~/.ssh/google_compute_engine instance_name

这篇关于命令“gcloud compute ssh”与“和“ssh”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
服务器开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆