This one-liner illustrates how to use SSH to tunnel through a firewall that allows only SSH. In this example, we’ll access the website on the other side of that server.
Why do this? If the remote server “remote.server” has a firewall on it or between your workstation and that server and you want to access a web-site on the remote.server, you will have trouble unless you use a very nice feature of SSH – tunnelling.
ssh -L 8080:localhost:80 [email protected] -p 22
The above is saying: use SSH and do a local redirection from port “8080” to the server “remote.server” on port “80” using the SSH server’s port 22. Port 22 is default but you can change it to be whatever port the “remote.server” is listening on for SSH sessions.
So direct your web browser to the following to see the website on the “remote.server” server.