1

I want to be able to logout inactive sessions on my webserver.
I have done this like so:

13. Restrict idle users. Timeout after a certain pre-defined amount of time. a. In the directory /etc/profile.d: i. Create a file called autologout.sh and add the following lines: TMOUT=300 readonly TMOUT export TMOUT This sets autologout settings for the bash shell. ii. Create a file called autologout.csh and add the following lines: set -r autologout 5 iii. Add execute privileges to both files with: sudo chmod +x /etc/profile.d/autologout.* 

I notice that the above lines log the user out only from the current active account and not terminate the session completely.
eg.) If I sudo-ed to root, I am logged out of root and returned to my user account.

Can I log the user out completely? If so, how do I do it?

1 Answer 1

1

Many years ago, I used to use a program called timeoutd to do exactly this. It seems to have vanished from debian since I last used it (or maybe it was never in debian and I compiled it myself - I can't remember, I last used it in the mid-1990s).

Anyway, I found a copy of it at:

https://launchpad.net/ubuntu/+source/timeoutd

It is configurable with an /etc/timeouts file. You can find the man page in the package, with the source, or at http://manpages.ubuntu.com/manpages/gutsy/man8/timeoutd.8.html

3
  • Thanks! This fits my use case beautifully. However, I am not allowed to compile any source etc. on the machine. I am marking this as correct. Commented Mar 8, 2016 at 12:35
  • what distro are you using? it may already be packaged for it. otherwise you could compile your own package on another machine, then it's just a single, simple install with your package manager (dpkg or rpm or whatever) Commented Mar 8, 2016 at 12:39
  • I am using Centos7. I checked the repos with sudo yum search timeout* and did not find anything. Is there anything else I should look for? The rpm option sounds good. I might try that. Commented Mar 8, 2016 at 12:41

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.