Created
August 28, 2018 11:31
-
-
Save caseyfw/c464f3f020ad7803576b08b05e2ee154 to your computer and use it in GitHub Desktop.
Reverse ssh tunnel systemd service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Reverse SSH tunnel to scratch. | |
After=network-online.target | |
Before=multi-user.target | |
DefaultDependencies=no | |
[Service] | |
Restart=always | |
RestartSec=10 | |
ExecStart=/usr/bin/ssh \ | |
-i /etc/tunnel/id_rsa \ | |
-o StrictHostKeyChecking=no \ | |
-o UserKnownHostsFile=/dev/null \ | |
-o ServerAliveInterval=20 \ | |
-o ServerAliveCountMax=1 \ | |
-o ExitOnForwardFailure=yes \ | |
-N \ | |
-T \ | |
-R 2222:localhost:22 \ | |
[email protected] | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Runs as root, though you could set the user to something unprivileged and put an ssh key in an appropriate spot.
-N
means "don't run any commands",-T
means "disable tty allocation".