This is a very useful thing to remember when I need to run a remote X application on a local machine.
Especially, when I need to test a web server which is not open to the public.
Before using ssh-tunneling, I had to setup ssh X-forward which is not safe at all and then run the web browser on the ssh-connected machine.
This causes a really heavy traffic.
ssh -C -o CompressionLevel=9 -L 5901:localhost:5901 USER@hostname
Where
There is another good example to do ssh-tunneling for accessing the secondary remote host so that we don't have to do “ssh” twice (e.g., first ssh to the first remote host and then second ssh to the second remote host).
ssh oscar.osl.iu.edu -L 10000:192.168.0.101:22 -g
After setting up the ssh-tunneling like this, run the following command to access the second host directly.
ssh -p 10000 localhost
Discussion