Skip to content

Instantly share code, notes, and snippets.

@icchy
Last active January 30, 2018 02:03
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 icchy/b84dc0d46441c8a899c237ee793814d1 to your computer and use it in GitHub Desktop.
Save icchy/b84dc0d46441c8a899c237ee793814d1 to your computer and use it in GitHub Desktop.
persistent reverse port forward with systemd
[Unit]
Description = SSH daemon for rescure
After = network.target
[Service]
ExecStart = /usr/bin/ssh \
-N \
-o "ExitOnForwardFailure=yes" \
-o "StrictHostKeyChecking=no" \
-o "UserKnownHostsFile=/dev/null" \
-o "ServerAliveInterval 60" \
-o "ServerAliveCountMax 3" \
-R 12345:127.0.0.1:22 host
Restart = always
Type = simple
User = user
[Install]
WantedBy = multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment