dwyl / learn-devops

🚧 Learn the craft of "DevOps" (Developer Operations) to Deploy your App and Monitor it so it stays "Up"!
GNU General Public License v2.0
417 stars 172 forks source link

How to avoid SSH Timeout when downloading large or lots of files? #73

Closed nelsonic closed 3 years ago

nelsonic commented 3 years ago

When attempting to download a large file (or set of files) over SSH (e.g. to Backup/Migrate a VM), the SSH Connection times-out and I have to restart the process. 🤦

I need to refresh my memory on how to do this.

Todo

This should only take a few mins of googling and reading, but i need to document it. 📝

This is a subtask of https://github.com/dwyl/hits/issues/81 which in turn will un-block https://github.com/dwyl/hits/issues/117 and https://github.com/dwyl/hits/issues/101 etc.

nelsonic commented 3 years ago

System Preferences > Energy Saver settings on Mac: "Computer sleep: Never" image

nelsonic commented 3 years ago

This looks like what I need: https://superuser.com/questions/699676/how-to-prevent-ssh-from-disconnecting

Edit your ~/.ssh/config file on your Mac (localhost) and add the following line:

ServerAliveInterval 60
nelsonic commented 3 years ago

Fail: linode-requires-javascript

nelsonic commented 3 years ago

185.3.95.195 178.79.141.232

lukeeey commented 3 years ago

Good to see you're still working on this 👍

nelsonic commented 3 years ago

Hi @lukeeey, 👋
Indeed ... 👨‍💻 ⏳

nelsonic commented 3 years ago

Ok, this seems to be working without needing to update anything on the VMs, just the ServerAliveInterval 60 in ~/.ssh/config on localhost is enough to keep the connection alive provided the Mac stays on.

I'm using an ancient (in computer terms) Mac Mini to backup the VMs: Screen Shot 2021-05-23 at 7 19 08 AM

and I left it on overnight downloading all the files from the two VMs. Switched off the screen to not waste energy, but the Mac Mini stayed on doing happily doing it's thing. I know I could use a Raspberry Pi Zero to do this task, I don't need an Intel i5 ... but this computer is "free" so I'm using it.