Skip to content

Instantly share code, notes, and snippets.

@vavrecan
Created May 7, 2022 21:14
Show Gist options
  • Save vavrecan/798b25ec83ec5a3117fae857bedbca77 to your computer and use it in GitHub Desktop.
Save vavrecan/798b25ec83ec5a3117fae857bedbca77 to your computer and use it in GitHub Desktop.
[Unit]
Description=AutoSSH tunnel service
After=network-online.target ssh.service
[Service]
User=root
Restart=always
ExecStart=/usr/bin/autossh -M 0 -q -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" admin@myip -R 2222:localhost:22
ExecStop=/usr/bin/killall -9 autossh
[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# systemctl enable autossh-tunnel
# systemctl start autossh-tunnel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment