service sshd restart
Thanks for this helpful post! I was having lots of trouble getting this to work for larger amounts of time (30-60 minutes) because I thought these were the settings for the actual timeout limit of the sshd sessions so I was setting the ClientAliveInterval to a very high value (3600 for an hour). BUT I didn't understand that this isn't changing the timeout limit -- those are set elsewhere (not sure where, but it doesn't matter) and seem to be 15 minutes on my Ubuntu Hardy system. What these ClientAlive___ settings do send a packet back and forth to the client every so often to keep the connection alive, so you must set the ClientAliveInterval to a number that is LOWER than whatever the built-in timeout is (so in my case, less than 900 [900 seconds=15 minutes]), then set the ClientAliveCountMax to the number of times you want that packet sent. So what worked for me to keep the session alive for an hour was to set both to 60 -- send the packet every 60 seconds, and do that 60 times. Phew!
Actually what i want to do is quite the opposite. I want to ignore keepalive and make sure users are logged out after 15 mins of idling. Only a handful of articles describing this problem and none of them seem to work.
If you want it to be 15 minutes change the values to 300 and 3. It's in seconds and repeated 3 times or whatnot.
@temotodochi, et al - Same here, I'm not interested in keeping the connection open (since that's not really a problem). I'm interested in logging the user out after 15 minutes of inactivity.
Same here - I've set these settings - and even without these setting the session stays open indefinitely.I can't find anything that works.
I found I had to set ClientAliveCountMax to zero. (Running on an old unsupported version of Ubuntu).ClientAliveInterval 60 ClientAliveCountMax 0Now it will log my session off after 60 seconds of idle.