Skip to content

Instantly share code, notes, and snippets.

@ossdev-somewhere
Created May 14, 2015 01:42
Show Gist options
  • Save ossdev-somewhere/b6a804b4961633df6691 to your computer and use it in GitHub Desktop.
Save ossdev-somewhere/b6a804b4961633df6691 to your computer and use it in GitHub Desktop.
autossh service file for systemd. place this file as /etc/systemd/system/autossh.service
[Unit]
Description=Keeps a ssh tunnel open
After=network.target
[Service]
User=yourusername
ExecStart=/usr/bin/autossh \
-M 0 -N -L '8080:somehost:8080' \
-o "BatchMode yes" \
-o "StrictHostKeyChecking no" \
yourservername
Restart=always
RestartSec=60
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment