I'm trying to establish the following chained ssh tunnel:
ssh -A -t gatewayuser@gatewayserver 'ssh -N -A -t -R 55520:127.0.0.1:55520 user@dbserver' &
This is part of a shell script, I want the tunnel to be established in the background so the shell script can continue what it is doing. The shell script also uses:
trap 'kill $(jobs -p)' EXIT
To kill all child procs on exit.
When the above ssh runs, a process is established but it seems the chained reverse tunnel is immediately dropped (i.e. there is nothing listening to 55520 on the dbserver). How can I do this within the requirements above?