Skip to content

Instantly share code, notes, and snippets.

@h-otter
Last active January 8, 2020 12:25
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h-otter/d244ebe06c316da92910577b9fa325b7 to your computer and use it in GitHub Desktop.
Save h-otter/d244ebe06c316da92910577b9fa325b7 to your computer and use it in GitHub Desktop.
[Unit]
Description=Keep reverse portforward tunnel
After=network.target
[Service]
User=root
Restart=always
RestartSec=5
Type=simple
ExecStart=/usr/bin/ssh -NTv \
-o "ServerAliveInterval 60" \
-o "ServerAliveCountMax 3" \
-o "ExitOnForwardFailure=yes" \
-o "StrictHostKeyChecking=no" \
-o "UserKnownHostsFile=/dev/null" \
-R 2222:localhost:22 \
-i /home/autossh/.ssh/id_ecdsa \
-p 22 \
-l autossh \
ssh.example
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment