Home Linux How To Auto Logout Idle Session For User In Linux

How To Auto Logout Idle Session For User In Linux

0
19
auto session logout

How To Auto Logout Idle Session For User In Linux

You can set the logout session for all users in Linux Server because if you don’t close the session, it will remain open up ideally. So it’s better to close it. You can do this automatically. Let’s see how to auto logout session.

Check Out : How To Check Linux Logs And Where They Exists O

There’re many ways to do this but i will show you few the best one. You can do this for security purpose.

Method 1 : you can do this by adding some parameter in .bsashrc file.

export TMOUT=600 # for 10 mins

readonly TMOUT

Apply the changes by running command, so user would not be able to change the values.

source /root/.bashrc

Check Out : How To Find UUID of Storage Devices

Method 2 : you can create a file under the directory /etc/profile.d

vim logoutsession.sh

export TMOUT=600 # for 10 mins

typeset -r TMOUT

Now you need to make this file to be executable.

chmod +x logoutsession.sh

As you can see i have created user “pankaj” and switch with this user on the Linux and left idle.

After 60 sec, you can see the message “time out waiting for input: auto> logout” means it’s working perfectly and user pankaj logout the session automatically.

YouTube Link : Auto logout session Linux

You’re done.

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

1 × five =