jerabaul29 / config_scripts_snippets

A repo for gathering some of my configs, scripts, and snippets
MIT License
0 stars 0 forks source link

systemd ssh tunnel #5

Closed jerabaul29 closed 2 years ago

jerabaul29 commented 2 years ago

https://askubuntu.com/questions/1316798/establishing-persistent-autossh-reverse-ssh-tunnel

vi /etc/systemd/system/tunnel.service

[Unit] Description=Maintain Tunnel After=network.target

[Service] User=localuser ExecStart=/usr/bin/ssh -i ~localuser/.ssh/tunnel -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -gnNT -R 22222:localhost:22 remoteuser@remotehost vmstat 5 RestartSec=15 Restart=always KillMode=mixed

[Install] WantedBy=multi-user.target

but use autossh