Closed jerabaul29 closed 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
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