LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices

Reply
 
Search this Thread
Old 12-05-2008, 04:08 PM   #1
deacon912
LQ Newbie
 
Registered: Aug 2008
Posts: 3

Rep: Reputation: 0
Users forget to log off and slow down the server


Hello,

I am using a using RHEL5 for a server that is accessed remotely. To log in Reflection X or XManager is used. Most users when they are done do not log out, they just turn their computer screen off while still connected to the server. This has been causing some problems recently when the number of logins gets around 50. Is there a way to automatically kill all users (except root) at a specific time of the day or limit the time a session is allowd to exist.

I have been using the kill -9 command to clean out the extra users each morning.

Thank you
 
Old 12-05-2008, 04:24 PM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,205

Rep: Reputation: 2472Reputation: 2472Reputation: 2472Reputation: 2472Reputation: 2472Reputation: 2472Reputation: 2472Reputation: 2472Reputation: 2472Reputation: 2472Reputation: 2472
Quote:
Originally Posted by deacon912 View Post
Hello,

I am using a using RHEL5 for a server that is accessed remotely. To log in Reflection X or XManager is used. Most users when they are done do not log out, they just turn their computer screen off while still connected to the server. This has been causing some problems recently when the number of logins gets around 50. Is there a way to automatically kill all users (except root) at a specific time of the day or limit the time a session is allowd to exist.

I have been using the kill -9 command to clean out the extra users each morning.

Thank you
Sure, just have a cron script run a "who -u | grep -v root", should give you just the non-root user names and PID's. Can probably do a one-liner using AWK to just barf out the PID's, and kill them, but don't know that syntax off the top of my head...
 
Old 12-05-2008, 05:43 PM   #3
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,238

Rep: Reputation: 121Reputation: 121
Check into the "timeoutd" package.
 
Old 12-08-2008, 02:49 PM   #4
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 163Reputation: 163
Quote:
Originally Posted by deacon912 View Post
Hello,

I am using a using RHEL5 for ...<SNIP>...

Thank you
There are several good solutions available depending on how you want to force the logout exactly.

The most simple solution if your users use bash or korn shell is to set the TMOUT variable in the system wide bashrc.

echo "export TMOUT=3600" >> /etc/bashrc
echo "readonly TMOUT" >> /etc/bashrc

Should work on RHEL4/5, On most debian derivatives you could do the same with the /etc/bash.bashrc file. The number is the number of seconds... a few round and handy useful values 300 (5 minutes), 1800 (30 minutes), 3600 (1 hour), 10800 (3 hours), and 86400 (24 hours). The readonly line prevents the users from altering it once they figure out what is going on.

If the users are SSHing into the system some versions of sshd will allow you to set "IdleTimeout" (unfortunately, most modern versions do not allow this.)

The alternative beyond that point is to use a watchdog program for ssh or a daemon to monitor idle time as suggested by a previous response.

Good luck and I hope it helps!

Last edited by rweaver; 12-08-2008 at 02:58 PM. Reason: Explain "readonly"
 
Old 12-31-2008, 08:14 AM   #5
deacon912
LQ Newbie
 
Registered: Aug 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Another Solution

I found a quick way to kill all processes used by a specific user. The skill -kill -u "username" command works perfectly.
 
Old 12-31-2008, 09:14 AM   #6
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 163Reputation: 163
Quote:
Originally Posted by deacon912 View Post
I found a quick way to kill all processes used by a specific user. The skill -kill -u "username" command works perfectly.
Nod, skill is an effective way to kill all their processes. The one thing to be aware of is that skill is also considered depreciated and unsupported. It may or may not be available in the future. On linux you can look into pkill or killall, but don't use the later on most other forms of unix as it does something completely different
 
  


Reply

Tags
bash, idle, timeout


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Report: Why Do Security Pros Forget About Users? LXer Syndicated Linux News 0 11-15-2008 04:12 AM
forget windows server password shipon_97 General 4 10-20-2006 06:20 PM
Server is slow,here are some log csstudy Linux - Software 4 09-23-2004 08:14 PM
How to log users access to a NIS server? blur Linux - Networking 1 04-26-2004 07:00 AM
Forget Gaim, jump to Kopete, specialy MSN users Teddy_Horse Linux - Software 1 10-23-2003 01:20 PM


All times are GMT -5. The time now is 02:34 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration