How do I enable auto-logout of Interactive ssh logins after one hour
Solution 1:
I already encountered situations where ClientAliveCountMax
prevents the connection to be disconnected. I would advise the following settings:
# ClientAliveInterval is in seconds
ClientAliveInterval 3600
ClientAliveCountMax 0
This will close the connection after 1 hour if idle.
Solution 2:
I had the same requirement and the SSHd ClientAlive* options did not work for me.
I think those are meant to keep the connection alive as opposed to cause when it times out. This means that it relies on the networking equipment timing out idle connection which is not always the case.
If you are running bash/ksh/zsh, you can use the TMOUT environment variable:
TMOUT=3600
This will time out your connection after 60 minutes.
For plain sh, you should be able to use:
TIMEOUT=3600
More info: http://www.cyberciti.biz/faq/howto-configure-shell-logout-user-automatically/