Operating System - Linux
1748057 Members
5321 Online
108758 Solutions
New Discussion юеВ

Re: ps output shows UID number instead of name

 
SOLVED
Go to solution
MikeL_4
Super Advisor

ps output shows UID number instead of name

I have a Red Hat server, that when I do a ps command on to display processes for a user, the UID Number shows instead of the name...

Any idea what could cause this ??

=> id
uid=602(infdukperf) gid=601(infinys) groups=601(infinys)

=> ps -fuinfdukperf
UID PID PPID C STIME TTY TIME CMD
602 1356 1 0 Jun10 ? 00:00:00 /opt/infdukperf/infinys/RB/bin/DConfigAgent
602 1361 1356 0 Jun10 ? 00:00:02 procSitter -T -N VPA01Domain
602 3806 23299 0 14:00 pts/1 00:00:00 /bin/ksh /opt/infdukperf/APS/IRB/tools/Query.ksh
602 5371 5370 0 14:25 pts/2 00:00:00 -ksh
602 5966 5371 0 14:30 pts/2 00:00:00 ps -fuinfdukperf
602 23299 23298 0 10:34 pts/1 00:00:00 -ksh
602 25832 1 0 11:15 ? 00:00:00 TM -u geneva_admin -p geneva_admin -s dkprft11

# grep ":602:" /etc/passwd
infdukperf:x:602:601:Infinys Duke Performance Test ID:/home/infdukperf:/bin/ksh
5 REPLIES 5
Matti_Kurkela
Honored Contributor

Re: ps output shows UID number instead of name

Please run "pwck".

For example, if the /etc/passwd line located just before user 602 has been corrupted somehow, it might cause problems in mapping the UID 602 back to username.

MK
MK
MikeL_4
Super Advisor

Re: ps output shows UID number instead of name

Ran pwck command, but didn'r resolve the issue:

# pwck
user adm: directory /var/adm does not exist
user news: directory /etc/news does not exist
user uucp: directory /var/spool/uucp does not exist
user gopher: directory /var/gopher does not exist
user ftp: directory /var/ftp does not exist
user pcap: directory /var/arpwatch does not exist
user avahi-autoipd: directory /var/lib/avahi-autoipd does not exist
user sabayon: directory /home/sabayon does not exist
user oprofile: directory /home/oprofile does not exist
pwck: no changes
#
Matti_Kurkela
Honored Contributor
Solution

Re: ps output shows UID number instead of name

Hmm, nothing significant in pwck output.

Wait... the user name "infdukperf" is 10 characters long, longer than the 8 characters available for the field in the "ps -fu" listing.

The description of the EUSER field in the ps command manpage says:
---
euser EUSER effective user name.

This will be the textual user ID, if it can be obtained and the field width permits, or a decimal representation otherwise. The n option can be used to force the decimal representation. (alias uname, user).
---

If the same algorithm is used in the UID field of the standard "ps -f" format listing, this would explain the behaviour.

Try a custom list format with a wider "username" field:

ps -o user:10,pid,ppid,c,stime,tty,time,cmd -u infdukperf

MK
MK
P Muralidhar Kini
Honored Contributor

Re: ps output shows UID number instead of name

Hi MikeL,

The username specified in the PS command "infdukperf" is more than 8
characters i.e. 10 characters long.

As per the Unix/Posix standards, the username/groupname gets printed as
decimal integers when there is no space in the column to display the
username. Truncating a username and displaying would cause confusion
when there are multiple user with same characters in the first few letters of
the username.

To solve the problem specify the width of the username display in the
PS command using the -o option.

Check the following link for more details -
https://bugzilla.redhat.com/show_bug.cgi?id=166431

Try this and let us know if the problem is solved.

Regards,
Murali
Let There Be Rock - AC/DC
MikeL_4
Super Advisor

Re: ps output shows UID number instead of name

Thanks a lot for the information... Did not realize it responded that way for names ove 8 characters...