openssh-unix-dev October 2011 archive
Main Archive Page > Month Archives  > openssh-unix-dev archives
openssh-unix-dev: Determining the port assigned by -R 0

Determining the port assigned by -R 0

From: Glenn Maynard <glenn_at_nospam>
Date: Fri Oct 14 2011 - 20:55:55 GMT
To: openssh-unix-dev@mindrot.org

It's difficult to programmatically determine the port dynamically assigned
by -R 0. The port is output in plain (and presumably localized) text, but
I've found that by far the most common use of this is for scripts.

Is there currently any sane way to get this information? For the short term
I'll probably just parse the plaintext "Allocated port..." message, but
that's obviously not a reliable solution. It would be helpful if a list of
forwarded ports was stored in a parsable environment variable, as with
SSH_CLIENT.

-- Glenn Maynard _______________________________________________ openssh-unix-dev mailing list openssh-unix-dev@mindrot.org https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev