Reverse Tunnel

Enabling Reverse SSH Tunneling in sshd_config
To allow reverse SSH tunnels (remote port forwarding), you need to enable GatewayPorts and ensure AllowTcpForwarding is enabled in /etc/ssh/sshd_config — these SSH settings allow the remote host to expose a port back to your local machine
on the remote server.
Edit the SSH configuration file:

sudo nano /etc/ssh/sshd_config

Ensure these settings are present and correctly configured:

                        
AllowTcpForwarding yes
GatewayPorts yes

If you want to restrict access to the tunnel, use:

GatewayPorts clientspecified   

This lets the client specify which IP can connect.