LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-10-2007, 10:44 AM   #1
xtremeclones
Member
 
Registered: Jan 2006
Posts: 70

Rep: Reputation: 15
how do i logout users


Hi everyone.

Say i so a W on my shell as root and this comes out.

USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 adsl-X.X.X 11:36 0.00s 0.02s 0.00s w
root pts/1 X.X.X.X Wed22 12:10m 6:58m 14.89s -bash
joe pts/2 X.X.X.X 11:02 6:57 0.38s 0.38s -bash
chris pts/4 X.X.X.X 11:25 7:29 0.15s 0.15s -bash

Say i need to logout both roots, i know one of them is me, but the other one although i know who it is, i want to logout both without stopping their services, so doing a pkill wouldnt work.

What is the correct command?

thanks for the help
 
Old 05-10-2007, 10:59 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
"logout without stopping their services".

Unless they backgrounded and nohup'ed the services they started then their going to receive a SIGHUP when the parent dies.

What you CAN do is check to see if they have any processes running:
ps -ftpts/0
Shows you what the first root user's terminal is running.

ps -ftpts/1
Show you what the second root user's terminal is running.

ps -ftpts/2
Show you what joe's terminal is running.

ps -ftpts/4
Shows you what chris' terminal is running.

If the only thing you see is "-bash" then you know they're not running anything else and can safely kill the the user. By the way if you do "kill -1" on the bash pid of the user it will clean up properly. I do this kind of thing all the time.

If I see anyone logged in for an inordinate amount of time that does have services then I track them down and find out what they're doing.

Also you can set TMOUT in /etc/profile or /etc/bashrc to cause automatic close of idle sessions such as the above. TMOUT=3600 means to logout after 1 hour of inactivity. Here we do that for standard users and set it to 1800 (1/2 hour) for root.
 
  


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
Logout Users carlosinfl Linux - General 5 05-10-2007 12:57 PM
Remotely Force Logout of other Users? CoolAJ86 Linux - Security 5 04-16-2005 06:51 AM
who and finger reporting logout users untoldone Linux - Newbie 1 03-19-2004 11:53 PM
On gnome / x logout run "logout" ?? once here Linux - Software 1 01-09-2004 02:53 PM
Give users the option to shut down in Gnome's logout oot Linux - General 4 05-12-2003 06:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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