Skip to content

Instantly share code, notes, and snippets.

@vitlav
Created February 11, 2017 12:49
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 vitlav/3bf0bd016754a39b66f24d46c6d51731 to your computer and use it in GitHub Desktop.
Save vitlav/3bf0bd016754a39b66f24d46c6d51731 to your computer and use it in GitHub Desktop.
autossh connection
[Unit]
Description=Keeps a tunnel to 'anyssh.ru' open
After=network-online.target
[Service]
User=server
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
# LOCALPORT:IP_ON_EXAMPLE_COM:PORT_ON_EXAMPLE_COM
ExecStart=/usr/bin/autossh -M 0 -N -q -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -p 22 a254@anyssh.ru -R 10254:localhost:22
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment