I've seen a similar question but it's different enough for the answer not to quite work.
I have two Debian Buster hosts - one in a private network (A); one in Azure (B).
I'd like Host A to initiate a reverse SSH connection from Host B. Then Host B subsequently to open a SOCKS proxy listener so that connections to that are tunnelled back to Host A. I would like to achieve all of this just by entering commands on Host A.
I know that I can set up the reverse SSH tunnel from Host B to Host A (initiated by Host A) like so:
ssh -R b:localhost:a b.b.b.b
a
= the listening port on Host A
b
= the listening port on Host B
and b.b.b.b
is the IP address of Host B.
How can I then get the second part - automatically creating a SOCKS proxy listener on Host B - to work? Is it even possible? Or would I need to create a script on Host B that creates the SOCKS proxy listener whenever netstat
shows the reverse SSH tunnel is Established (or similar)?
Editted to try and clarify based on first answer.
Asked by noisey_uk
(101 rep)
Jul 14, 2020, 07:40 PM
Last activity: Jun 23, 2025, 06:01 AM
Last activity: Jun 23, 2025, 06:01 AM