Achei ssh_exchange_identification: Connection closed by remote host
que fosse causado por /etc/hosts.allow
e/ou /etc/hosts.deny
, mas a única entrada de permissão é ALL:ALL
e negar está vazia.
No meuVM do Google CloudEu já adicionei:
ALL:ALL
para\etc\hosts.allow
e\etc\hosts.deny
está vazioUma configuração de regra de firewall para oVM do Google Cloudpara permitir tcp:2222
GatewayPorts clientspecified
para/etc/ssh/sshd_config
Dedestino(o computador que desejo acessar) ao meuVM do Google Cloud:
ssh -R 0.0.0.0:2222:localhost:22 -i google_compute_engine -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no <username>@<google vm ip>
Depois disso Netstat -plant 2222
produz:
tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN 2700/0
Dentro doVM do Google Cloud:
ssh -p 2222 -i google_compute_engine localhost -v
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 2222.
debug1: Connection established.
debug1: identity file google_compute_engine type -1
debug1: identity file google_compute_engine-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
ssh_exchange_identification: Connection closed by remote host
Se eu remover -p 2222, o ssh
comando se conectará localmente.