Last active
July 3, 2017 05:12
-
-
Save spvkgn/de9895ca0cc8ab49157c704d8d1631e8 to your computer and use it in GitHub Desktop.
AutoSSH tunnel systemd unit
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=AutoSSH service for a reverse tunnel from some.example.com to localhost | |
After=network.target | |
After=networking.service | |
[Service] | |
Environment=AUTOSSH_FIRST_POLL=30 | |
Environment=AUTOSSH_GATETIME=0 | |
Environment=AUTOSSH_POLL=60 | |
Environment=USERNAME=user | |
Environment=HOSTNAME=host | |
User=user | |
Group=user | |
ExecStart=/usr/bin/autossh -M 0 -ND 1080 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -i /home/user/.ssh/id_rsa ${USERNAME}@${HOSTNAME} | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
put here
/etc/systemd/system/autossh.service
systemctl enable autossh.service
systemctl start autossh.service