'Double tunnel hop ssh

I'm using WinSSHTerm to connect to a proxy, from which I then connect to a server hosting a data warehouse. I just can't figure out how to reproduce my Putty connection using a shell command.

Short recap:

I first connect to the proxy server which maps the port 5432 to my local port 10001. After that, i connect to the database server and map its 5432 port to my proxy's 5432 port, which I previously mapped to my 10001 port locally. I am then able to connect to the databse via a database manager locally.

To do so:

I created the following connection to my proxy server first.

enter image description here

I then added a tunnel from there to my localhost port 10001.

enter image description here

Once I'm logged in to the proxy server, I use the following command to connect to the database server and map its 5432 port to the proxy's 5432 port.

ssh username@databaseServer -L 127.0.0.1:5432:databaseServer:5432

I'd like to leave putty and move to WinSSHterm, predefine some login commands for a specific server.

How may I reproduce the behavior above using a shell command?

Here's my initial try, which is unfortunately not working:

ssh username@databaseServer -L 127.0.0.1:5432:databaseServer:5432

enter image description here

Thank you

ssh


Solution 1:[1]

I was finally able to find the correct way to write it.

Loginc Cmds

ssh username@databaseServer -L 127.0.0.1:5432:databaseServer:5432

Cmd-line Args

-L 10001:localhost:5432

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Djabone