autossh not forwarding, regular ssh tunnel does Starting autossh like so: autossh -M 5122 -N -R 5432:localhost:5432 &lt;user&gt;@&lt;myhost&gt;, I can't connect to localhost:5432. If I run ssh -f &lt;user&gt;@&lt;myhost&gt; -L 5432:localhost:5432 -N -v -v, I can.

The output from autossh:

debug1: Local connections to LOCALHOST:5122 forwarded to remote address 127.0.0.1:5122
debug1: Local forwarding listening on ::1 port 5122.
debug2: fd 6 setting O_NONBLOCK
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 5122.
debug2: fd 7 setting O_NONBLOCK
debug1: channel 1: new [port listener]
debug1: Remote connections from LOCALHOST:5122 forwarded to local address 127.0.0.1:5123
debug1: Remote connections from LOCALHOST:5432 forwarded to local address localhost:5432
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: remote forward success for: listen 5122, connect 127.0.0.1:5123
debug1: remote forward success for: listen 5432, connect localhost:5432
debug1: All remote forwarding requests processed


And from ssh:

debug1: Local connections to LOCALHOST:5432 forwarded to remote address localhost:5432
debug1: Local forwarding listening on ::1 port 5432.
debug2: fd 6 setting O_NONBLOCK
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 5432.
debug2: fd 7 setting O_NONBLOCK
debug1: channel 1: new [port listener]
debug1: Requesting no-more-sessions@openssh.com
debug1: forking to background
debug1: Entering interactive session.


I've just recently started playing around with ssh tunneling and cannot figure out why autossh will only forward port 5122.
A bit late to answer, but maybe it still helps someone.

I had the same problem, turns out you need to use -L instead of -R:

autossh -M 5122 -L 5432:localhost:5432 &lt;user&gt;@&lt;myhost&gt;