Suppose I have a computer compute_mine. I have ssh access to two remote computers compute_remote_1 and compute_remote_2. I would like to forward a port from compute_remote_1 to compute_remote_2. However, I would like to initiate and control the port forwarding process from compute_mine. No data from compute_remote_1 or compute_remote_2 should be forwarded to compute_mine.
I need the port forwarding to be automatically terminated when the process on compute_mine terminates for whatever reason. I would also like to avoid multiple ssh instances.
A rough approximation would be an ssh ProxyCommand issued from compute_mine as follows: On compute_mine: ssh into compute_remote_2 'ProxyCommand forward port from compute_remote_1 to local port on compute_remote_2'
I have tried various ssh ProxyCommands but nothing has worked so far. Any suggestions ?
I have tried various ssh ProxyCommands issued from compute_mine to remote_compute_2. For example: ssh -o 'ProxyCommand=ssh -W host:port user@remote_compute_1 -v' user@remote_compute_2 -P port_number -NTC
This quit with the error: banner exchange: Connection to UNKNOWN port 65535: invalid format
Thanks Kamil Maciorowski for suggesting the edit about process termination.