Shells: AUTO LOGOFF of idle users


I set up an Ubuntu 9.04 Server fordevelopment purpose and made it online through dyndns [more info], It can access by anyone of our team. We got some accessing problem because all our developers logged in through ssh without any need. So there are many users logged in and stay idle.


What we need to increase the efficiency is to force all idle users out. Here how I do this:


THIS IS BASED ON UBUNTU SERVER EDITION 9.04




At first you have to open Terminal from:
Applications->Accessories->Terminal


Step 01: Got to /etc/profile.d/


#cd /etc/profile.d/


Step 02: Open any create an empty file named logout.sh and open it using Text Editor.


#touch logout.sh
#nano logout.sh


Step 03: Type the following in Text Editor


TMOUT=600


IMPORTANT: DO NOT ADD ANY SPACE IN BETWEEN CODE.
600 = 10 Minutes(600 Seconds)


Save & Exit the text editor


Step 04: Make shell script executable.


#chmod ugo+x logout.sh


Thats all.


chmod is used for change mode, it can change file system modes of files and directories.


Wikipedia Page [link] and MANual [link] for chmod



Now on all users who took more than 10 minutes idle, put out of the shell automatically.

Try login to your server, after doing this and stay idle for 10 minutes


You will get a message like this : 
timed out waiting for input: auto-logout


and will logout from server automatically.



0 comments:

Post a Comment