S
S
Siegurd12021-05-25 12:32:27
linux
Siegurd1, 2021-05-25 12:32:27

How to make a Reverse SSH connection to a remote host through an intermediate SSH server specifying only the IP and Port in the SSH client?

Recently I have been practicing with Reverse SSH connection and found that I cannot connect to a remote host with any of the popular SSH clients from a Windows host.
The setup is the following:

  • Host 1 - modem with Linux (gray IP);
  • Host 2 - Raspberry PI with SSH server (static IP);
  • Host 3 - Windows desktop with SSH client (MobaXterm or PuTTY);
  • Host 2 and Host 3 are on the same LAN. Port forwarding on the router has been done so that Host 2 is accessible from the Internet.

What I tried and what works:
From the modem (Host 1) I create a Reverse ssh connection to the Raspberry PI (Host 2):

ssh -p 1111 -R 1111:localhost:22 [email protected]

On the Raspberry PI (Host 2) I use this command to connect to the modem (Host 1):

ssh [email protected] -p 1111

And the connection works! But, the idea is to connect to the modem (Host 1) from the Windows desktop (Host 3) via Host 2. I'm trying an OpenSSH connection from Windows PowerShell:

ssh -A -tt -p 2222 [email protected] 'ssh [email protected] -p 1111'


and it works! The connection is being established.

But how to write:
ssh -A -tt -p 2222 [email protected] 'ssh [email protected] -p 1111'
in any other SSH client? For example, MobaXterm with very convenient SFTP or good old PuTTY require only the IP and Port fields to be filled in.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
unseriously, 2021-05-25
@Siegurd1

https://ubccr.freshdesk.com/support/solutions/arti...

F
Fenrir89, 2021-05-27
@Fenrir89

Putty has the functionality of running a command after connecting. More details here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question