Connect remote computer with reverse ssh tunneling
Assume we have an intermediate server with static ip or domain.
On the destination computer:
ssh -N -R 9876:localhost:22 uesr@jump.server
This will establish a connection between the destination computer and the intermediate server, and forward all traffic from port 9877 on the server to port 22 (the default port for ssh connection) on the destination computer.
Also we have to add GatewayPorts yes
to the sshd
configuration
(at /etc/ssh/sshd_config
) on the intermediate server and restart
the ssh service.
sudo service ssh restart
Then we can connect to the destination computer with:
ssh remote@jump.server -p 9876
sshReach.me and SERVEO provide such service.
For SERVEO, use:
ssh -R myalias:22:localhost:22 serveo.net
and
ssh -J serveo.net user@myalias
© 2019 Notes on Learning Flight