Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have Eucalyptus installed on my Linux machine, and I've noticed that for processes owned by the eucalyptus user, ps reports the userid instead of the username. For example:

$ sudo -i -u eucalyptus
$ ps u
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
107      29764  0.0  0.0  19376  2104 pts/2    S    11:43   0:00 -bash
107      30198  0.0  0.0  15256  1180 pts/2    R+   11:44   0:00 ps u

What would cause this to happen?

Note that there's a proper entry in /etc/passwd:

$ grep eucalyptus /etc/passwd
eucalyptus:x:107:115::/var/lib/eucalyptus:/bin/bash

Also note that ls property reports the ownership of files by the eucalyptus account:

$ touch foo
$ ls -l foo
-rw-r--r-- 1 eucalyptus eucalyptus 0 2010-09-23 11:47 foo
share|improve this question
add comment

3 Answers

up vote 17 down vote accepted

ps uses the uid when the username is longer than 8 characters.

share|improve this answer
    
Good call. From the man page: "This will be the textual user ID, if it can be obtained and the field width permits, or a decimal representation otherwise." –  Michael Mrozek Sep 23 '10 at 19:16
    
Or perhaps there is no way to translate UID to name. –  vonbrand Jan 23 '13 at 15:52
add comment

You can control the width of columns:

ps o user:12,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,comm

this reproduces the u format of ps u, but it makes the user field 12 characters wide.

share|improve this answer
add comment

Sure you have a problem with your /etc/passwd... you edited it manually, didn't you? :)

anyway, I reproduced the problem copying the line of the user in /etc/passwd and changing the user name by the user id.

Like this:

root@juice:/etc/# grep 129 /etc/passwd
129:x:129:137:Puppet configuration management daemon,,,:/var/lib/puppet:/bin/false
puppet:x:129:137:Puppet configuration management daemon,,,:/var/lib/puppet:/bin/false

Note that the "numbered user" is the first.

root@juice:/etc/# sudo -u puppet -s
129@juice:/etc/$ whoami
129

129@juice:/etc/$ touch /tmp/a
129@juice:/etc/$ ls -l /tmp/a
-rw-r--r-- 1 129 puppet 0 2010-09-23 19:12 /tmp/a

129@juice:/etc/$ ps u
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
129      12443  2.2  0.1   7112  4380 pts/1    S    19:12   0:00 /bin/bash
129      12490  0.0  0.0   2716  1068 pts/1    R+   19:12   0:00 ps u

Try to execute "whoami", sure it returns 107 :)

It is a strange behaviour, ps returns the number and ls the normal name :-m...

To solve it:

  • just edit /etc/passwd and delete the incorrect entry
  • or use 'userdel 107', but all programs from eucalyptus must be stoped
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.