Skip to content

Instantly share code, notes, and snippets.

@kumekay
Last active February 8, 2016 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kumekay/51c39b17d9d8c1820070 to your computer and use it in GitHub Desktop.
Save kumekay/51c39b17d9d8c1820070 to your computer and use it in GitHub Desktop.
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
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 remoteuser@middleserver.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment