Restricting port forwarding on remote server

Juanito juam at posteo.net
Wed Jan 3 02:24:20 AEDT 2018


Hi Dale,

Thanks for your mail.
> I'm not sure exactly what you're asking.  The -R argument to ssh causes
> the remote sshd to forward one port back to localhost:22.  What that
> port is depends on the value of the -R argument, which in your case is
> constructed using $port.  But you haven't told us the value of $port in
> this shell when this command is executed.
>

In my example, where I didn't express myself very clearly, I meant port
to be 10000. The idea would be for port 10000 on the server to redirect
to port 22 (ssh) on the device I wish to reach.

So I could do something like:

ssh -p 10000 user at server

to connect to port 22 on the device.

So the device would use autossh to create such a tunnel, and shouldn't
be able to open a tunnel in any other port other than 10000 with a
command similar to this:

ssh -nNTv -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -o
IdentitiesOnly=yes -R 10000:localhost:22 user at server

I hope I managed to express myself a little better :)

Thanks again!

Cheers,
Juanito



More information about the openssh-unix-dev mailing list