SSH Configuration

Allow user user1 and root, but reject all others:

AllowUsers user1 root
DenyUsers all

Connection keepalive:

ssh_config:
    ServerAliveCountMax 2 # the keepalive msg to send before disconnected
    ServerAliveInterval 60 # in seconds

or

sshd_config:
    ClientAliveCountMax 2 # the keepalive msg to send before disconnected
    ClientAliveInterval 60 # in seconds