Tunneling Web Traffic through SSH
To open a connection to a secure shell server you can simply type the following command in a linux terminal emulator:
ssh username@remote-server
Once you’ve opened an ssh connection to a remote server you can run commands on it as if you were sitting right at the local terminal. What if that server is connected to another network you need to access, but your local machine is not? What if you need to use one of the applications you have installed locally to access resources on the other network? The ssh protocol allows you to tunnel traffic through an ssh connection, so all you need to do is set up a local proxy to send all your traffic out from the server. This is done easily using the terminal ssh client in linux.
ssh -D port username@remote-server
This creates a socks5 proxy that sends all network traffic directed to your localhost, on whatever port you specify for the -D switch, to your ssh server as ssh traffic, then out to the network endpoint as its original protocol. Responses from the network endpoint will be handled by the ssh server in the same manner, but in reverse. All network traffic you send through this proxy will be encrypted from your computer to your ssh server, which is useful on untrusted networks, or on unencrypted wifi where anyone could be observing your network traffic.