I want to tunnel VNC traffic to
host2, which is only accessible from
host1 is publicly accessible.
I setup a multi-hop SSH tunnel as described in this question, using:
ssh -L 5901:localhost:6000 host1 ssh -L 6000:localhost:5901 -N host2
This indeed works perfectly and does the job. However, I don't know how to correctly close the nested tunnel. I tried Ctrl+c but this seems to kill the first
ssh instance to
host1. But, the second
ssh tunnel between
host2 remains open, which is highly undesirable as any one can actually forward traffic through it.
-N option, I don't get an actual
host2, so I can't simply
exit from there.
-N, I still don't get a
tty, instead I get the following error:
Pseudo-terminal will not be allocated because stdin is not a terminal. Warning: no access to tty (Bad file descriptor). Thus no job control in this shell. term: Undefined variable.
I am starting the connection from MacOS X, and both host1 and host2 are running RHEL 6.