Skip to content

Instantly share code, notes, and snippets.



Last active Feb 8, 2016
What would you like to do?
Reverse SSH tunnel with autossh started with upstart for ubuntu. Allows to connect to computer hidden behind NAT over SSH. Good replacement for vpn in some cases
# File: /etc/init/autossh.conf
# Start ssh tunnel after network for specified user
description "Start autossh reverse tunnel"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [016]
respawn limit 5 60
exec autossh -M 0 -N -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -o "StrictHostKeyChecking=no" -o "BatchMode=yes" -i /home/user/.ssh/id_rsa -R 5522:localhost:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment