LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-01-2010, 09:05 AM   #1
paliga
Member
 
Registered: Feb 2010
Posts: 39

Rep: Reputation: 0
logged users without processes?


Hi,

curenntly I try to write a script which would kill processes of users who are not logged in.

My approach is to find out what users are logged in and then kill processes of all nonsystem users who fail the test of being logged.

I use `w` for finding all logged in users, but apparently there are users on the list which `w` gives me who own absolutely no process in the output of `ps aux`.

Some questions regarding this:
- How do I log off those users, since killing their processes wont work (since they own no processes)?
- How could it had happen?
- Is there a better way to actually find out what users are really logged in?

Thanks in advance,
chris
 
Old 11-02-2010, 02:14 AM   #2
divyashree
Senior Member
 
Registered: Apr 2007
Location: Bangalore, India
Distribution: RHEL,SuSE,CentOS,Fedora,Ubuntu
Posts: 1,386

Rep: Reputation: 135Reputation: 135
Try the command:

Quote:
last
 
Old 11-02-2010, 06:25 AM   #3
rew
Member
 
Registered: May 2010
Posts: 36

Rep: Reputation: 3
paliga, if users have no processes, they cannot be logged in.

when a user logs in, a note is made in a file, such that programs like "w" know who's logged in. When a user is logged out the system attempts to note that into that file too. However this requires a few more cpu cycles from their "login" program. If for instance a program (script) kills their programs, the "note that we're now logged out" may have become impossible. So, "w" might show someone logged in on say "ttyp4", but if no program is running that ttyp4 is "free" and may be taken by then next user to log in. At that point in time the outdated information will be overwritten.

In short: don't worry about it. If you can't find any processes, they are not actually logged in.

Oh, and besides... It works much better if you just ask your users not to leave any programs running, and tell them you'll take measures if they do. The way you're doing things now will trigger an arms race between you and the students leaving you as the loser. (there is almost always a student smarter than you).
 
Old 11-02-2010, 02:04 PM   #4
paliga
Member
 
Registered: Feb 2010
Posts: 39

Original Poster
Rep: Reputation: 0
thanks for your answers!

last is much more handy than w or who... thanks a lot...

I was just wondering... Im far away from starting any arms races... ; )
 
Old 11-02-2010, 02:05 PM   #5
paliga
Member
 
Registered: Feb 2010
Posts: 39

Original Poster
Rep: Reputation: 0
thanks for your answers!

last is much more handy than w or who... thanks a lot...

I was just wondering... Im far away from starting any arms races... ; )
 
  


Reply


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
4 of the same users logged on... true_atlantis Linux - Newbie 1 04-13-2006 11:54 PM
why so many logged in users? alagenchev Linux - Security 2 03-24-2005 06:19 PM
users who logged before czezz Solaris / OpenSolaris 1 11-24-2004 06:12 AM
No Users logged in X kaise_sose Linux - Software 2 10-19-2004 02:57 AM
processes remain after I have logged out! drgowans Red Hat 5 11-12-2003 03:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:37 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration