How to keep connections alive on ssh MacOS Catalina?

Solution 1:

Catalina is same as all the older OS X and macOS for this. For you, it seems the hidden ssh folder is what’s stopping your attempt to configure the file. My commands make the directory and then clobber any file you may have so don’t use the cat > and expect to keep old file contents. You can then edit the file once it’s set.

mkdir -p ~/.ssh
cat > ~/.ssh/config << EOF
Host keepsdroppingme.com
ServerAliveInterval 120
EOF

Of course you need to put the host you care about having the 120 second keep alive traffic being synthetically generated whether you’re typing or not. On the server side, they can still enforce a timeout, but this often works wonders.