Member-only story
Uncovering an Obscure SSH Feature: How 90% of Developers Are Missing Out
SSH (Secure Shell) is a popular protocol used for remote access to servers. It provides a secure, encrypted connection between two machines and allows for secure remote access to services running on a remote machine. One of the key features of SSH is port forwarding, which enables a user to access a service on a remote machine as if it were running locally.
There are two types of port forwarding: local and remote. In this guide, we’ll cover both types and provide step-by-step instructions on how to set up SSH port forwarding.
Local Port Forwarding
Local port forwarding is used when you want to access a service on a remote machine that is configured to allow only localhost
connections. In such cases, you can use SSH to create a tunnel between your machine and the remote machine and access the service as if it were running locally.
To demonstrate this, let’s assume that we have a remote machine running an Apache web server and it’s configured to allow only localhost
connections. To access it from your local machine, you can use SSH to set up local port forwarding.
First, add the following snippet to the Apache configuration file on the remote machine:
<Directory /var/www/html>…