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
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.