OS X: SSH tunnel in OS X Lion

Best and easiest way to secure your internet connection in untrusted network (like free Wi-Fi hotpot)?
SSH Tunnel :)

You’ll just need a shell account on a server and You’re ready to go. Fire up Terminal:

ssh -D 8080 -f -C -q -N user@yourserver.com

-D 8080 : This basically does a lot of dynamic stuff and makes it behave as a SOCKS server. Of course you could use any non privileged port here (above 1023).
-f : This will fork the process into the background after you type your password.
-C : Turns on compression.
-q : Quiet mode. Since this is just a tunnel we can make it quiet.
-N : Tells it no commands will be sent. (the -f will complain if we don’t specify this).

Then open System Preferences -> Network.

Select active network connection, click Advanced... -> Proxies -> SOCKS Proxy.

In SOCKS Proxy Server enter localhost:8080 and You’re DONE! :)

Now You can check if Your IP Address changed in www.whatsmyip.org.