Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JonathanPorta/0e0fd08f51f5a5ec7a1c5560ca224d03 to your computer and use it in GitHub Desktop.
Save JonathanPorta/0e0fd08f51f5a5ec7a1c5560ca224d03 to your computer and use it in GitHub Desktop.
ssh-tunnel.service
# A reverse ssh tunnel systemd service.
[Unit]
Description=Create an SSH tunnel for the MTNA service
ConditionPathExists=|/usr/bin
After=network.target
[Service]
User=stanparker
Environment="AUTOSSH_DEBUG=True"
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -M 0 -N -T -q -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -R 22222:localhost:22 [email protected]
# Restart every >2 seconds to avoid StartLimitInterval failure
RestartSec=3
Restart=always
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment