Created
April 17, 2017 20:10
-
-
Save erronjason/33dd2ff81eb883b043f4e99672fc6c1b to your computer and use it in GitHub Desktop.
Reverse SSH systemd service
This file contains 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
# /etc/systemd/system/rssh.service | |
[Unit] | |
Description=Reverse SSH Service | |
ConditionPathExists=|/usr/bin | |
After=network.target | |
[Service] | |
User=<USERNAME HERE> | |
ExecStart=/usr/bin/ssh -NTC -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -i /home/<USERNAME>/.ssh/h -R <PORT YOU WANT OPEN ON REMOTE MACHINE>:localhost:<LOCAL SSH PORT> -l <REMOTE USERNAME> -N <REMOTE HOST> -p <REMOTE LISTENING PORT> | |
# 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