Setup Automatic Users Logout After a Period of Inactivity

Below script will implement a 5 minute idle time-out for the default /bin/bash shell.

Step 1: Create file autologut.sh

Append the following code:

Step 2: Save and close the file. Set permissions:

*For tcsh version follow the below process

Step 1: Create file autologut.sh

Append the following code:

Step 2: Save and close the file. Set permissions:

For SSH user inactive interval we can define that in configuration file of the ssh server

Step 1 : Configure /etc/ssh/sshd_config file

Find ClientAliveInterval and set to 300 (5 minutes) as follows:

Step 2: Save and close the file. Restart sshd:

The following two tabs change content below.

Tapas Mishra

Sr. Engineer (DevOps)
Loves to work on Opensource products. Having experience on Linux environment. Knowledge on Public cloud services like AWS, Rackspace, DigitalOcean, Linode. Please don't hesitate to give a comment on the posts. Your comments are my strength.

Leave a Reply