Add 'autossh-tunnel.service'

This commit is contained in:
tim 2022-04-04 06:51:44 +00:00
parent 0eedc83163
commit 06ba18ba89
1 changed files with 12 additions and 0 deletions

12
autossh-tunnel.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=autossh tunnel
After=network-online.target
[Service]
User=<user> # Make sure user has access to the relevant ssh key
ExecStart=/usr/bin/autossh -C -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" <-L, -R or -D port forward> -M 2000 <user>@<host> -i /home/<user>/.ssh/<ssh_key>
# Add "GatewayPorts yes" to the server's sshd_config if you want external access to remote ssh port forwards
# Example port forward remotley accessing a computer behind a NAT/firewall: -R 2222:127.0.0.1:22
[Install]
WantedBy=multi-user.target