Puzzled by -R dropping first argument

Rudolf Potucek RudolfPotucek at smarttech.com
Tue Dec 17 14:21:27 EST 2013


Hi All!

I am puzzled. I am using openssh 5.3p1 on RHEL/CentOS but am seeing the same behaviour for osx and debian:

ssh -R xxx:yyy:yyy:yyy remotehost

Will effectively drop the first (xxx) argument and result in

ssh -R 127.0.0.1:yyy:yyy:yyy remotehost
ssh -R yyy:yyy:yyy remotehost

I had a look at the source code where apparently all 4 values are ready and handed down to the appropriate forwarding request. Yet in the end the first argument gets dropped / replaced?

I can see two important uses of -R and would really like to make this work, even if this means I have to patch all my ssh client and server packages:

(1) Allowing the reuse of a local port if something is already listening on that port and the client can only be pointed at an IP, not a custom port:

ssh -R 127.0.0.2:ppp:127.0.0.1:ppp remotehost

which works perfectly in reverse

ssh -L 127.0.0.2:ppp:127.0.0.1:ppp remotehost

but poses a security risk because now the client would know the server password.

(2) Picking an interface in a multihomed system

Any suggestions welcome,

  Rudolf


More information about the openssh-unix-dev mailing list