Can someone explain SSH tunnel in a simple way?
00:05 12 Mar 2011

Although I use some aliases to do ssh tunnel or reverse tunnel, I never understand how it works. Does somebody know how to explain it in a very simple way?

I think the 3 primary uses are:

First of all, I can use my home computer to ssh to foo.mycompany.com, without using any password (foo is a server at work)

  1. How to make foo.mycompany.com:8080 go to my home computer's localhost:3000?

  2. If at home, I cannot access http://bar.mycompany.com, but foo can access bar, how to make the home computer able to access http://bar.mycompany.com?

  3. If at home, I cannot access MySQL db at db.mycompany.com, but foo can, how to make it possible to access db.mycompany.com also using ssh tunnel?

Can it be explained in very simple terms? Are there actually some other popular use cases besides these 3? Thanks.

ssh ssh-tunnel