Remote Port Forwarding using SSH Tunnel

If you want someone on the internet to access a service/port on your local system(and you have access to a remote server), you can use SSH Tunnel to do this.

Step 1: Configure the Remote Server

Edit the /etc/ssh/sshd_config file – you’ll need Root privileges for this. Make sure these values are set…

AllowTcpForwarding no
GatewayPorts yes

Once this is done, restart the SSH Server on the remote server using sudo service ssh restart

Step 2: Run this command on the system that should be accessed…



ssh -nNT -R 8080:localhost:80

Now, just point the browser to and the browser will connect to localhost:80. You can change port numbers to access other services.

Source: A visual guide to SSH tunnels

Author: Binny V A
A philosopher programmer who specializes in backend development and stoicism.

Leave a Reply

Your email address will not be published. Required fields are marked *