【GCP】ssh_exchange_identification: read: Connection reset by peer

環境

  • クライアント:Mac OS Mojave 10.14.1
  • サーバー:Ubuntu 16.04

エラー

今までは以下のコマンドでGCPに入れたのに、何故か突然エラーを吐き出すようになった。

$ gcloud compute --project "<PROJECT_NAME>" ssh --zone "<REGION_NAME>" "<VM_NAME>" 
ssh_exchange_identification: read: Connection reset by peer
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].

原因、解決方法

どうやらサーバー側でアクセスが許可されていなかったことが原因らしいが、なぜ突然アクセス出来なくなったのか…??

$ sudo chmod 777 /etc/hosts.allow
$ vi /etc/hosts.allow # CentOSの場合は/var/log/secure

sshd: ALL # これを追加