I have to access an openvpn-vpn server behind a firewall, so to do this I use an ssh-reverse tunnel. While using the "normal" ssh command works, connecting via autossh does not. For all the other connections autossh works fine.

  • SSH-Command:

    ssh -R user@server -N
  • Autossh-Command:

    /usr/bin/autossh -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -N -R user@server
  • Error message while trying to connect with autossh:

    debug1: connect_next: host localhost ([]:1149) in progress, fd=7
    debug3: channel 2: waiting for connection
    debug1: channel 2: connection failed: Connection refused
    connect_to localhost port 1149: failed.
    debug3: send packet: type 92
    debug2: channel 2: zombie
    debug2: channel 2: garbage collecting
    debug1: channel 2: free:, nchannels 3
    debug3: channel 2: status: The following connections are open:

I don't know what the difference might be here, anyone knows what could be wrong?

1 Answer 1


Found the solution, for anyone who has the same problem:

Instead of:

/usr/bin/autossh -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -N -R user@server

The command needs to be like this:

/usr/bin/autossh -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -o ExitOnForwardFailure=yes -R user@server -N

So the -N option needs to be at the end.

You must log in to answer this question.

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