Live data from Hacker News

Autossh – automatically restart SSH sessions and tunnels

github.com

1–10 of 90 posts

Re: Autossh – automatically restart SSH sessions and tunnels

#4

Curious what advantages this has over mosh? https://mosh.org/

mosh is for interactive sessions, to keep them working when the connection is flaky.

autossh is for keeping unattended ssh tunnels alive, if the connection is flaky or one end is only intermittently available. So for using tunnels for the sort of thing you might otherwise use a VPN for.

Re: Autossh – automatically restart SSH sessions and tunnels

#6
If you have systemd, you could do this:

    [Unit]
    Description=look ma, no autossh
    After=network.target
    
    [Service]
    Type=exec
    ExecStart=/usr/bin/ssh -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -Nn -R 7070:localhost:22 pc 'sleep 20m'
    Restart=always
    RestartSec=20
    RuntimeMaxSec=30m
    
    [Install]
    WantedBy=default.target

Re: Autossh – automatically restart SSH sessions and tunnels

#7
I used to use autossh to set up a SOCKS proxy to tunnel my web browser traffic via my home network and it worked really well. Also had a ControlMaster on the tunnel which made SSH connections to my server instantaneous.

Nowadays I use wireguard an a dedicated SOCKS proxy. The upside is that I can access everything on my home network directly without having to tunnel.

Post reply on HN