Você precisa ter o serviço sshd iniciado e escutando na porta 22 no servidor A
Isto é o que eu corro no servidor (A) para abrir o túnel:
ssh -vf -N -T -R 222:localhost:22 me@myserverip -p 2222
Isso é o que eu executo no servidor myserver
(B) para usar o túnel:
ssh -vp 222 me@localhost
Aqui estão os registros depois de tentar usar o túnel:
B:
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016
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 1975.
debug1: Connection established.
debug1: identity file /home/aran/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aran/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aran/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aran/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aran/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aran/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aran/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aran/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
ssh_exchange_identification: Connection closed by remote host
A:
debug1: client_input_channel_open: ctype forwarded-tcpip rchan 2 win 2097152 max 32768
debug1: client_request_forwarded_tcpip: listen localhost port 1975, originator 127.0.0.1 port 51384
debug1: connect_next: host localhost ([127.0.0.1]:22) in progress, fd=4
debug1: channel 0: new [127.0.0.1]
debug1: confirm forwarded-tcpip
debug1: channel 0: connection failed: Connection refused
connect_to localhost port 22: failed.
debug1: channel 0: free: 127.0.0.1, nchannels 1
Alguém pode me explicar o que estou perdendo aqui?
Você precisa ter o serviço sshd iniciado e escutando na porta 22 no servidor A
Tags ssh reverse-tunnel