Bug 3133 - Dynamically Assigned Ports for DynamicForward and LocalForward
Summary: Dynamically Assigned Ports for DynamicForward and LocalForward
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 8.2p1
Hardware: All All
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-10 03:19 AEDT by Chris
Modified: 2021-04-24 06:12 AEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris 2020-03-10 03:19:49 AEDT
The RemoteForward option allows a port to be dynamically assigned if 0 is entered as the port number. It would be helpful if the ssh client could do the same for DynamicForwards and LocalForwards.
Comment 1 Norman Rasmussen 2021-04-24 06:12:25 AEST
+1. RemoteForward has had the ability to dynamically allocate the listening port since bz#1003, but LocalForward doesn't currently support it.

I'd like to be able to do something like:
$ ssh -MNf remote
$ port=$(ssh -O forward -L 0:localhost:1234 remote)
$ client localhost:$port

without having to do a "localport=$(( 32000 + $RANDOM )); ssh -L $localport:localhost:1234 && break" loop, or something similar.