How do I keep SSH connection alive on Windows 10?
In C:\Users\yourusername\.ssh
make a new file named config
, and add the lines below:
Host *
ServerAliveInterval 40
You can solve this on the client side by setting the options ServerAliveInterval and ServerAliveCountMax (60 and 30 will send a keep-alive packet every minute and still keep the connection if your network falls for up to 30 minutes).
The Windows OpenSSH client has some issues finding the ssh_config file (it appears to have doubts about what the "home" directory is in a Windows System), so you may have to explicitly provide the config file path with -F:
ssh -F C:\wherever\ssh_config user@host
On the server side you can edit /etc/ssh/sshd_config, edit/add the similar ClientAliveInterval and ClientAliveMaxCount options and restart the sshd service.