You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@mohammed90 I ended up using "golang.org/x/crypto/ssh" package, and checking for the requested port if it's 0 I chose a random port. Here is a rough overview of what I've done to achieve this:
After digging a bit more and based on SSH manual page, if the listen port is 0 the server should inform the client by sending the dynamically allocated port. We can achieve that by this:
hey guys, thank you for this great library.
As far as I know, when we run
ssh -R0:localhost:9999 server-ip
a random port will be chosen by OS (hence the 0: at the beginning), but I can't see which port has been chosen in theReversePortForwardingCallback
in the following example (taken from: https://github.com/gliderlabs/ssh/blob/master/_examples/ssh-remoteforward/portforward.go):If I connect to this server by
ssh -R0:localhost:9999 server-ip
I get this message on my terminal: attempt to bind localhost 0 granted.Now, does this library choose a random port, and if yes how can I access it?
The text was updated successfully, but these errors were encountered: