jerabaul29/config_scripts_snippets

systemd ssh tunnel

jerabaul29 opened this issue · 0 comments

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