Linux – Trouble enabling GatewayPorts for Remote Port Forwarding over SSH

linuxport-forwardingssh

I'm trying to use an Ubuntu server to do remote port forwarding over ssh.

I've edited /etc/ssh/sshd_config to contain the following lines at the bottom of the file:

...

Match User david
  GatewayPorts yes
  AllowTcpForwarding yes

Then I tried testing the config worked by rebooting the server, logging in and running the following:

sshd -T | grep -E 'gatewayports|allowtcpforwarding'

Unfortunately the result is:

gatewayports no
allowtcpforwarding yes

What am I missing to enable this so I can use remote port forwarding for testing local applications remotely?

ssh -R 8080:localhost:8080 david@example.com

Related:

Best Answer

sshd -T -C user=david,host=localhost,addr=127.0.0.1 \
 | grep -E 'gatewayports|allowtcpforwarding'

should return correct values for your user.

Related Question