Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 05-10-2007, 11:44 AM   #1
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.

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, 11:59 AM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,515
Blog Entries: 15

Rep: Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470
"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.


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

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

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