Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 3
    You should add any reasons that you'd use this script over autossh, or is it just that it's easier this way?
    – remmy
    Commented Oct 20, 2012 at 17:25
  • 5
    This wouldn't help if ssh itself freezes, would it?
    – nafg
    Commented Nov 25, 2013 at 23:59
  • 8
    It helps if you can't install things in the server. autossh doesn't come preinstalled and bureucracy it's sometimes very obtuse.
    – quarkex
    Commented Mar 13, 2017 at 15:13
  • 4
    Yes, preferable not to have to install things. I've been doing it this way for a year as my only way to keep a remote machine accessible (even set crontab to run it upon reboot). It's never failed, and more importantly, I know why it will never fail.
    – sudo
    Commented Apr 2, 2018 at 6:42
  • This is amazingly simple and very tempting :) an alternative though not as secure to key auth is sshpass command. Commented Aug 12, 2021 at 1:05