How to limit the remote port (server side) when tunneling through SSH?

91 Views Asked by At

How do I configure my sshd to limit the port the client can tunnel to?

example:

A is client and B is server

A executes ssh -L local-port:localhost:remote-port user@B

B needs to be able to deny the tunneling if the remote port does not match a fixed value

Is this possible in ssh?

I tried

PermitOpen localhost:port

and

PermitListen port

inside sshd configuration but they didn't seem to work. But I'm not sure this is the right syntax.

0

There are 0 best solutions below