-
-
Save kehh/64e0869726ad979781e305398bdf2115 to your computer and use it in GitHub Desktop.
Systemd service for autossh
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
[Unit] | |
Description=Keeps a tunnel to 'remote.example.com' open | |
After=network-online.target | |
[Service] | |
User=autossh | |
# -p [PORT] | |
# -l [user] | |
# -M 0 --> no monitoring | |
# -N Just open the connection and do nothing (not interactive) | |
# LOCALPORT:IP_ON_EXAMPLE_COM:PORT_ON_EXAMPLE_COM | |
ExecStart=/usr/bin/autossh -M 0 -N -q -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -p 22 -l autossh remote.example.com -L 7474:127.0.0.1:7474 -i /home/autossh/.ssh/id_rsa | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bvankuik commented on 11 Oct 2016 • edited
On Ubuntu (at least from version 16.x Xenual Xerus), create the above file as a normal user, then install it with:
Enable as follows:
mikhailnov commented on 12 Mar
Also add
in the [Service] section if you experience problems like autossh.service: Start request repeated too quickly..