How to keep connections alive on ssh MacOS Catalina? I am trying to keep connections alive to my university server. It keeps disconnecting after 2-3 minutes of inactivity and it gets very frustrating to keep relogging in. I tried many things online but I am unable to edit any of the files.

I have tried following instructions here: https://www.a2hosting.com/kb/getting-started-guide/accessing-your-account/keeping-ssh-connections-alive

Perhaps the problem is that I dont have a ~/.ssh/config file - changes I try to make to the below given files, I keep getting this:


-- INSERT -- W10: Warning: Changing a readonly file
E45: 'readonly' option is set (add ! to override)
"sshd_config" E212: Can't open file for writing


When I try to create it (copy and paste the command you use here), it says this:

mkdir: .ssh: Permission denied

I am happy to answer any further questions you may have :)

This is what my /etc/ssh looks like:



This is what ssh_config looks like:


and this is what my sshd_config looks like:


Is there a better guide to creating my ssh config so I can have my client ssh keep alive the connection to the server?
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 &gt; and expect to keep old file contents. You can then edit the file once it’s set.

mkdir -p ~/.ssh
cat &gt; ~/.ssh/config &lt;&lt; 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.