LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 03-28-2006, 11:41 AM   #1
Sarolearthy
LQ Newbie
 
Registered: Sep 2005
Posts: 10

Rep: Reputation: 0
Users Command displaying incorrect Usernames


When I use the "users" command it shows me a list of users that are in the system. For some reason however the users that it lists are not the proper users in the system. For instance if John, Sara and Rosa are logged in, and it lists Mike Jessica and Kathy insted. Sometimes it lists usernames twice, and sometimes the correct usernames come up, but for the most part they show incorrectly. We have had this problem before and when we restarted the server it corrected itself. We are looking for a way to correct it without restarting the server. (My boss is finicky about restarting)

Thanks for the help

Sam
 
Old 03-28-2006, 11:53 AM   #2
Hobbletoe
Member
 
Registered: Sep 2004
Location: Dayton, Oh
Distribution: Linux Mint 10, Linux Mint 11
Posts: 148

Rep: Reputation: 18
Why not use the w command. It will show you who all is on the system, along with what they are using. Please note that it too will give you multiple instances of a user, depending on what all they are doing, but, if you want just a list, try something like

Code:
w -h | cut -d' ' -f1 | sort -u

Last edited by Hobbletoe; 03-28-2006 at 11:59 AM.
 
Old 03-28-2006, 12:05 PM   #3
Sarolearthy
LQ Newbie
 
Registered: Sep 2005
Posts: 10

Original Poster
Rep: Reputation: 0
I just tried the command you suggested, and it shows only one user logged into the system. While the Users command shows 20+. The user shown with the W command is incorrect as well.
 
Old 03-28-2006, 12:54 PM   #4
Hobbletoe
Member
 
Registered: Sep 2004
Location: Dayton, Oh
Distribution: Linux Mint 10, Linux Mint 11
Posts: 148

Rep: Reputation: 18
Well, I'm not really sure then. It should have shown at least the user that ran the command. And I'm not sure why it would show an incorrect user. (Incorrect I am taking to mean a user that is not currently logged into the system.) Both the users and w commands take information from the /var/run/utmp file by default (users can be fed a different file apparently). Is there anything wrong with that file? Looks like it should be 664 root:utmp. Do you have another process that has been set up to write to that file per chance?
 
Old 03-28-2006, 01:25 PM   #5
Sarolearthy
LQ Newbie
 
Registered: Sep 2005
Posts: 10

Original Poster
Rep: Reputation: 0
Your definition of incorrect was what I meant, sorry about not being specific enough. Yes it is currently 664 root : utmp. Is there anyway to recreate/rebuild the file while the server is running? Or is it something that only happens when the system is rebooted.

Thanks for all the help

Sam

Last edited by Sarolearthy; 03-28-2006 at 01:39 PM.
 
Old 03-28-2006, 01:41 PM   #6
Hobbletoe
Member
 
Registered: Sep 2004
Location: Dayton, Oh
Distribution: Linux Mint 10, Linux Mint 11
Posts: 148

Rep: Reputation: 18
664 root:utmp would be the permissions (rw-rw-r--), and owner:group, so that all looks ok. The file is binary, so regular editors won't do the trick. You can put it through strings to have a look at it

Code:
strings /var/run/utmp | more
Though I'm afraid that it isn't going to really help a lot. Mine looks like ...

Code:
reboot
runlevel
tty1
root
tty2
LOGIN
(Dxx
tty3
LOGIN
(Dny
tty4
LOGIN
(Dnz
tty5
LOGIN
tty6
LOGIN
chris
pts/0
chris
(Dft
chris
pts/2
chris
pts/3
chris
tty1
LOGIN
From what I can figure out, it appears to be a list of available terminals (tty1, is the terminal that you switch to if you press Ctrl-Alt-F1). I am logged in as root on tty1, and as myself via KDE. Where it says LOGIN it is awaiting a log-in. I have no idea what the (Dxx listings are about.

I'll have to look and see if I can find anything about re-starting the service that writes to that file (once I figure out what it is), but have someone comming by to install a DVD burner for me in a few minutes, so it might be a bit.
 
Old 03-28-2006, 01:51 PM   #7
Sarolearthy
LQ Newbie
 
Registered: Sep 2005
Posts: 10

Original Poster
Rep: Reputation: 0
I tried the strings command that you listed and I think it helped us narrow down the problem, or at least I hope. The file is seemingly a neverending list of terminals, some repeating. Could it be that, that for what ever reason when people log out they are not being removed from this list and its causing conflicts?


Sam
 
Old 03-28-2006, 02:54 PM   #8
Hobbletoe
Member
 
Registered: Sep 2004
Location: Dayton, Oh
Distribution: Linux Mint 10, Linux Mint 11
Posts: 148

Rep: Reputation: 18
It could be possible, though I would hope not as it appears that the init process is what writes/updates that file. And if there is an issue with init ...

You can try sending SIGHUP to init and see if it in some way cleans up that file. I'm not really sure if it would delete/recreate that file or not, but you can give it a whirl. Shouldn't hurt your system none (I've done it offten on our Solaris boxes).
First, you'll need to find the PID of the init process and then send SIGHUP.

Code:
ps -ef | grep -v grep | grep init
Note that you'll probably get a few lines returned. Look for the one that is init all by itself. The PID is the second column. For me, it turns out to be the first process, so ...

Code:
kill -HUP 1
 
Old 03-28-2006, 03:14 PM   #9
Sarolearthy
LQ Newbie
 
Registered: Sep 2005
Posts: 10

Original Poster
Rep: Reputation: 0
root 1 0 0 2005 ? 00:01:43 init
was the return from the command you listed.
I proceeded with the Kill command and the problem still persists.

I'm heading out of the office soon, so anything you post I wont be able to check till tomorrow. Thanks again for the help I really appriate it.


Sam
 
Old 03-29-2006, 08:57 AM   #10
Hobbletoe
Member
 
Registered: Sep 2004
Location: Dayton, Oh
Distribution: Linux Mint 10, Linux Mint 11
Posts: 148

Rep: Reputation: 18
Ok. I've been looking at this a bit more, and even deleted my /var/run/utmp file to see if it would be re-created. It wasn't. It did write to that file if I were to log in from a different terminal after that, but that isn't going to correct your problem as you won't have anyone currently logged in written to the /var/run/utmp file unless you make everyone log out then back in.

The only other thing that I can think of that might be your problem is if your user ids have been re-used, but chances are you would have noticed this in other ways by now (people with a $HOME that is different than what it should be, things like that) so I doubt that that is the problem.

Another command that you can try would be

Code:
last | grep "still logged in" | cut -d' ' -f1 | sort -u
That should show you who all is logged into the system currently much as w and users would.

Hopefully that will get you what you need as I'm just about out of ideas.
 
Old 03-29-2006, 04:27 PM   #11
Sarolearthy
LQ Newbie
 
Registered: Sep 2005
Posts: 10

Original Poster
Rep: Reputation: 0
Everyone who works in my company logs out at the night, so if deleting would reset the file so that when everyone would log in next it would re-create and be up to date that would be acceptable. I'm not sure if where implying the file would be re-created or it would write the information elsewhere.

Oh and that command did work, thank you very much. I would still like to find a way to fix this file in the event it has any effects on any other programs we have, we've notice sometimes the incorrect (not logged in users) are showing up on double vision, but when you take control of that user it'll end up being an entirely different user currently logged into the system.

Sam
 
Old 03-29-2006, 09:02 PM   #12
Hobbletoe
Member
 
Registered: Sep 2004
Location: Dayton, Oh
Distribution: Linux Mint 10, Linux Mint 11
Posts: 148

Rep: Reputation: 18
Well, I'm glad that command works for you. I really wouldn't suggest deleting that file until I knew what all depends on that file. I deleted it because it was on my laptop, and I can easily re-install should it really flub up the system (though I think a re-boot would do it as well). As it sounds like you are running a live server, those options are not anywhere near as appealing.

I'll continue to look at this a bit more in my spare time (installing Oracle 9i on a server and are ramping up to start putting 10g on all of ours in the near future). I'll let you know if I find anything.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
howto run the htpasswd command with input from file for 500 usernames !! PK2K Linux - Software 4 02-02-2006 03:54 AM
Displaying users email quota in SM? panicbox Linux - Software 3 01-19-2006 01:34 AM
qmail server, local users sending mail with incorrect email addresses HoundDog Linux - Networking 2 01-04-2006 03:40 AM
Changing Usernames/password command? wardialer Linux - Security 7 02-26-2005 01:15 AM
displaying services from command line stellarmarine1 Linux - Enterprise 5 10-01-2004 04:28 AM


All times are GMT -5. The time now is 06:36 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration