It seems since autossh changed their syntax, I am a bit overstrained in establishing a reverse ssh tunnel via autossh with my server. This is the script I am trying to run:

autossh -M 20000 -f -N -R 17999:localhost:22 user@server -pXXXX -i id_rsa

Where 20000 is the monitor port (that autossh seems to need now), 17999 ist the port on my server autossh should listen to, 22 is the open port on my local machine and XXXX is the open SSH-port on my server. But nevertheless, my journalctl shows this:

autossh[7891]: ssh exited with error status 255; restarting ssh

In a row. Where did I got wrong? The pure SSH equivalent I am using is

ssh -fNC -R 17999:localhost:22 user@server -pXXXX -i id_rsa

And this works just fine.

1 Answer 1


Nevermind, I found the problem myself: It seems that autossh in opposition to ssh drops out of the current directory when starting the connection, i.e. -i id_rsa wasn't readable by autossh, beacause it has left the directory in wich my RSA-key was at the time it tried to establish a connection. Providing the full path to my key has helped and autossh now works like expected.

  • You will encounter this behaviour in many other commands. You are not dealing with Windows, the current PATH e.g. . usually is not searched by default. So you have either to write the full path or ./file instead of file Nov 10, 2018 at 12:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .