Place these settings in the ssh server (sshd) configuration file and restart sshd:
/etc/ssh/sshd_config
ClientAliveInterval 120
ClientAliveCountMax 3
TCPKeepAlive yes
The other way, and easier and safer way is for your desktop machine to send those keep alive messages. As root on your desktop (or client) machine, edit /etc/ssh/ssh_config and add the line:
ServerAliveInterval 60