15
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gceにローカルからgcloudで接続できなくなった場合、そうubuntuで。

Posted at

gceのVMにgcloudで接続できなくなった時

  • gcloudと書いてるけど、sshでも一緒かもしれない、きっと一緒だ
  • ubuntuと書いてるけど、きっと他のlinuxでも一緒かもしれない

gcloudeで接続しようとして下記のエラーが出た場合

junk@junk-VirtualBox:~$ gcloud compute --project "custom-unison-XXXXX" ssh --zone "asia-east1-a" "main"
Warning: Permanently added '104.155.XXX.XXX' (ECDSA) to the list of known hosts.
Permission denied (publickey).
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].

対応

1.ローカルPCの接続ユーザのhome下.ssh内の「google_compute_engine.pub」のファイル内容をコピーする。
※このキーはrsaの公開鍵です

view ~/.ssh/google_compute_engine.pub

2.Webの[Compute Engine]の[VM インスタンス]から対象のVMをクリックしサーバの詳細設定を開く。

image

4.そのサーバのsshに先ほどコピーした公開鍵のテキストを貼り付ける

image

5.[保存]をクリック

6.gcloudで接続してみる。

junk@junk-VirtualBox:~$ gcloud compute --project "custom-unison-XXXXX" ssh --zone "asia-east1-a" "main"
Warning: Permanently added '104.155.XXX.XXX' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 12.04.5 LTS (GNU/Linux 3.13.0-55-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Sat Jul 18 02:47:16 UTC 2015

  System load:  1.09              Processes:           110
  Usage of /:   3.1% of 98.40GB   Users logged in:     1
  Memory usage: 20%               IP address for eth0: 10.240.67.98
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

New release '14.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


Your Hardware Enablement Stack (HWE) is supported until April 2017.

Last login: Sat Jul 18 01:43:57 2015 from 121.110.XX.XXX
junk@main:~$ 

接続できるようになりました!

15
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?