12

This guide to remote port forwarding says you need to add GatewayPorts yes to /etc/ssh/sshd_config when setting up remote SSH port forwarding.

But I cannot tell whether that needs to be added to the machine you are entering the ssh command into, or the machine you are remotely forwarding the port from.

3
  • 2
    I don't think GatewayPorts yes is a good idea. Much safer to use GatewayPorts clientspecified.
    – kasperd
    Feb 12, 2018 at 0:18
  • @kasperd - Is it possible to use clientspecified when the machine running ssh -R does not have a fixed IP? Feb 12, 2018 at 4:16
  • No problem, -R '[::]:2222:[::1]:22' should work just fine if that's what you want.
    – kasperd
    Feb 12, 2018 at 8:25

1 Answer 1

14

GatewayPorts is an option available for sshd_config, so it applies to the host you are connecting to.

3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .