Last active
November 9, 2020 16:07
-
-
Save anikishov/367cc58a4a62d2bea797ac0541cdc773 to your computer and use it in GitHub Desktop.
Autossh systemd service config
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
Forward web-port (5000) and ssh (22). | |
systemctl daemon-reload | |
systemctl enable autossh.service | |
[Unit] | |
Description=Auto Reverse SSH | |
After=network.target auditd.service | |
[Service] | |
Type=simple | |
ExecStart=/usr/bin/autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -N -p 22 -R 0.0.0.0:1122:127.0.0.1:22 -R 127.0.0.1:5000:127.0.0.1:5000 <autossh_server_hostname> | |
Restart=always | |
RestartSec=3 | |
[Install] | |
WantedBy=multi-user.target | |
##### | |
# Need add following option in /etc/ssh/ssh_config | |
# autossh options | |
ExitOnForwardFailure yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment