User Tools

Site Tools

This wiki is read only and for archival purposes only. >>>>>>>>>> Please use the new OpenWrt wiki at <<<<<<<<<<


Autossh monitors a ssh connection and reconnects the ssh-session if the connection fails.

To automatically log in you need to use an authentication key.

The package, slightly outdated, can be found in the 'oldpackages' feed.

Alternative packages:

sshtunnel is a simpler, functionally-identical package. (depends on OpenSSH so higher disk space requirements)

Use Case

  • You want to forward a local port (e.g. the webserver/ssh) to a remote server.
  • If your client running OpenWrt is behind a NAT, this allows to connect to a server that is not behind a NAT and create a reverse tunnel to the local ssh server.


  1. Install autossh
    opkg install autossh
  2. Create a key
    dropbearkey -t rsa -f /etc/dropbear/id_rsa
    • On LEDE 17.01.x use
      dropbearkey -t rsa -f /root/.ssh/id_dropbear
  3. dropbearkey will print the public key, starting with ssh-rsa.
    • You can reprint the key using
      dropbearkey -y -f /etc/dropbear/id_rsa
    • or you can write it to a file (e.g. /tmp/pubkey)
      dropbearkey -y -f /etc/dropbear/id_rsa | grep ssh-rsa > /tmp/pubkey
  4. Add the key to the authorized_keys file on your server, e.g. copy pubkey file to the server and do
    cat pubkey >> ~/.ssh/authorized_keys


Autossh is configured using the Unified Configuration Interface (/etc/config/autossh).


To get ssh working you need to replace localhost in 2222:localhost:22 of the ssh variable to the local ip.

doc/howto/autossh.txt · Last modified: 2017/10/13 18:03 by tmomas