Create reverse tunnel with autossh and systemd
Install autossh with sudo apt install autossh Create autossh.service in /etc/systemd/system/ folder The content of autossh.service: [Unit] Description=AutoSSH service for a reverse tunnel from SERVER to localhost After=network-online.target # start after DNS ready, but seems no difference with network-online.target #After=nss-lookup.target [Service] ExecStart=autossh -M [LOCAL_PORT] -N -D [YOUR_LOCAL_IP]:[LOCAL_PORT] -i [YOUR_PRIVATE_KEY] [REMOTE_USER]@[REMOTE_USERVER] RestartSec=5 Restart=always [Install] WantedBy=multi-user.target Execute… Read More »