LoginSignup
0
0

ChromeOSからcrostini使ってGCPにgcloudでsshしようとしたけどできなかった記録

Last updated at Posted at 2018-11-18

はじめに

crostiniからGCEにsshしようとしたけど、うまくいかん・・・。

gcloudのインストール

ここのサイトに従った。
Cloud SDK のインストール  |  Cloud SDK のドキュメント  |  Google Cloud

curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud init

これをやって、ポチポチすすめた。defaultのzone?とか聞かれた気がする。GCEのんに揃えた。

ここらも参考
Google Compute Engine のSSH接続 - Qiita

$ gcloud compute ssh instance-1
WARNING: The private SSH key file for gcloud does not exist.
WARNING: The public SSH key file for gcloud does not exist.
WARNING: You do not have an SSH key for gcloud.
WARNING: SSH keygen will be executed to generate a key.
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/xxx/.ssh/google_compute_engine.
Your public key has been saved in /home/xxx/.ssh/google_compute_engine.pub.
The key fingerprint is:
SHA256:yyy xxx@penguin
The key's randomart image is:
+---[RSA 2048]----+
+----[SHA256]-----+
Updating project ssh metadata...⠧Updated [https://www.googleapis.com/compute/v1/projects/zzz].
Updating project ssh metadata...done.                                                              
Waiting for SSH key to propagate.
Warning: Permanently added 'compute.zzz' (ECDSA) to the list of known hosts.
Permission denied (publickey).
ERROR: (gcloud.compute.ssh) Could not SSH into the instance.  It is possible that your SSH key has not propagated to the instance yet. Try running this command again.  If you still cannot connect, verify that the firewall and instance are set to accept ssh traffic.

よくわからんけど、.ssh/google_compute_engine.pubをVMのssh鍵登録するとこにコピペしてみたけど、駄目やった。

image.png

.ssh/google_compute_engineのパーミッションみてもリードできそうやった。

firewallも確認したけど、大丈夫そう。

$ gcloud compute firewall-rules list
default-allow-ssh       default  INGRESS    65534     tcp:22                              False

telnetでポートの確認した。大丈夫そう。

$ telnet IP 22
Trying IP...
Connected to IP.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.6
^[
Protocol mismatch.
Connection closed by foreign host.

いろいろやったけど、エラー出る。

$ gcloud compute ssh instance-1 
Permission denied (publickey).
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].

ここらも参考にした。
GCEで事前準備(SSHでサーバー接続するまで編) - ゼロからWeb開発

おわりに

よくわからん。
インスタンスが容量いっぱいいっぱいなのも関係してるんかなー。
変な設定になってるんかなー。
教えて、詳しい人。
そろそろインスタンス一度消して、設定しなおそかな・・・。

0
0
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
0
0