November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Automatic Users Logout After a Period of Inactivity

* For SH/BASH/TCSH

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

Step 1: Create file autologut.sh

# vi /etc/profile.d/autologout.sh

Add New

Append the following code:

TMOUT=300

readonly TMOUT

export TMOUT

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

# chmod +x /etc/profile.d/autologout.sh

 

*For tcsh version follow the below process

Step 1: Create file autologut.sh

# vi /etc/profile.d/autologout.csh
Append the following code:

set -r autologout 5

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

# chmod +x /etc/profile.d/autologout.csh

 

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

Step 1 : Configure /etc/ssh/sshd_config file

# vi /etc/ssh/sshd config

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

ClientAliveInterval 300

ClientAliveCountMax 0

Step 2: Save and close the file. Restart sshd:
# service sshd restart

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>