I'm looking for a way to have the server allocate an available port
number when using remote port forwarding.

In draft-ietf-secsh-connect-25.txt such a feature is described but I
fail to see if/how this is actually supported by openssh.

Quote from the draft:

If a client passes 0 as port number to bind and has 'want reply'
TRUE then the server allocates the next available unprivileged port
number and replies with the following message, otherwise there is
no response specific data.

Naively doing things like -R0:host:hostport fail with a "Bad
forwarding port(s)" message.



openssh-unix-dev mailing list