summaryrefslogtreecommitdiff
path: root/doc/autossh.md
blob: fb41a15640ef76ea6995ec0d92cd4facf03c685a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
`/etc/systemd/system/my-ssh-tunnel.service`:

```
[Unit]
Description=ssh tunnel
After=network.target
StartLimitIntervalSec=0

[Service]
User=user
Group=user
Restart=always
RestartSec=1
ExecStart=autossh -M 0 -NC -R 127.0.0.1:44223:127.0.0.1:22 -o StrictHostKeyChecking=no -o LogLevel=ERROR -o ExitOnForwardFailure=yes -o ServerAliveInterval=15 -o ServerAliveCountMax=2 user@host
WorkingDirectory=/home/user

[Install]
WantedBy=multi-user.target
```

On server:

```
ClientAliveInterval 15
ClientAliveCountMax 2
```