0

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:

Xeoncross
  • 4,432
  • 9
  • 36
  • 48

1 Answers1

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

should return correct values for your user.

Jakuje
  • 10,032
  • 5
  • 33
  • 34
  • Great! I am not sure why I didn't think about context being needed. However, the [sshd manpage](http://man.openbsd.org/OpenBSD-current/man8/sshd.8) states that user, host, and addr are all required so I modified your string: `sshd -T -C user=david,host=localhost,addr=127.0.0.1 | grep -E 'gatewayports|allowtcpforwarding'` – Xeoncross Jun 20 '16 at 14:57
  • Thanks for the note. I forgot that all of them are need. Fixed now. – Jakuje Jun 20 '16 at 15:19