ps lists user as uid instead of username

  • Follow


I'm confused by my "ps aux" output. The owners of most processes are listed 
by name (as is typical).

e.g.
foouser  20644  0.0  0.0  90116  1924 ?        S    21:49   0:00 sshd: 
foouser@pts/7

But there's one user who's always listed by her uid (512 in this case):

512      17068  0.0  0.0  90116  1876 ?        S    18:16   0:00 sshd: 
baruser@pts/3

In the /etc/passwd file they look similar:

foouser:x:502:100:foos Name:/home/foouser:/bin/bash
baruser:x:512:100:bars Name:/home/baruser:/bin/bash

What else could be causing this difference? I'm stumped! 

-- 
Rahul
0
Reply Rahul 8/11/2010 3:02:43 AM

Rahul <nospam@nospam.invalid> writes:

> I'm confused by my "ps aux" output. The owners of most processes are
> listed by name (as is typical).
>
> e.g.
> foouser  20644  0.0  0.0  90116  1924 ?        S    21:49   0:00 sshd: 
> foouser@pts/7
>
> But there's one user who's always listed by her uid (512 in this case):
>
> 512      17068  0.0  0.0  90116  1876 ?        S    18:16   0:00 sshd: 
> baruser@pts/3
>
> In the /etc/passwd file they look similar:
>
> foouser:x:502:100:foos Name:/home/foouser:/bin/bash
> baruser:x:512:100:bars Name:/home/baruser:/bin/bash
>
> What else could be causing this difference? I'm stumped! 

Perhaps username is too wide for the column.

$ ps -ef|grep exim
101       2368     1  0 09:55 ?        00:00:00 /usr/sbin/exim4 -bd -q30m
$ ps -e -o user:20,pid,ppid,c,stime,tty,cmd|grep exim
Debian-exim           2368     1  0 09:55 ?        /usr/sbin/exim4 -bd -q30m

-- 
http://www.greenend.org.uk/rjk/
0
Reply Richard 8/11/2010 10:30:27 AM


Richard Kettlewell <rjk@greenend.org.uk> wrote in
news:87tyn1fnlo.fsf@araminta.anjou.terraraq.org.uk: 

> Perhaps username is too wide for the column.
> 
> $ ps -ef|grep exim
> 101       2368     1  0 09:55 ?        00:00:00 /usr/sbin/exim4 -bd
> -q30m $ ps -e -o user:20,pid,ppid,c,stime,tty,cmd|grep exim
> Debian-exim           2368     1  0 09:55 ?        /usr/sbin/exim4 -bd
> -q30m 
> 
> 

Yup! That's it. Thanks!

-- 
Rahul
0
Reply Rahul 8/11/2010 5:11:51 PM

On Wednesday, August 11th, 2010 at 17:11:51h +0000, Rahul wrote:
>
> Yup! That's it. Thanks!

By ze vay, you do know that if you want to see the actual username rather
than userid, you can create your own ps output format listing using
the -o parameter.

     -o format       user-defined format.

                     format is a single argument in the form of a
                     blank-separated or comma-separated list, which offers a
                     way to specify individual output columns. The
                     recognized keywords are described in the STANDARD
                     FORMAT SPECIFIERS section below. Headers may be renamed
                     (ps -o pid,ruser=RealUser -o comm=Command) as desired.
                      If all column headers are empty (ps -o pid= -o comm=)
                      then the header line will not be output. Column width
                      will increase as needed for wide headers; this may be
                      used to widen up columns such as WCHAN
                      (ps -o pid,wchan=WIDE-WCHAN-COLUMN -o comm). Explicit
                      width control (ps opid,wchan:42,cmd) is offered too.
                      The behavior of ps -o pid=X,comm=Y varies with
                      personality; output may be one column named "X,comm=Y"
                      or two columns named "X" and "Y". Use multiple -o
                      options when in doubt. Use the PS_FORMAT environment
                      variable to specify a default as desired; DefSysV and
                      DefBSD are macros that may be used to choose the
                      default UNIX or BSD columns.

This can be useful if you wish to stick to SYSV format but want full
command line details instead of resorting to the BSD ps auwwwwx format.
0
Reply miller (477) 8/11/2010 5:37:51 PM

On 08/10/2010 10:02 PM, Rahul wrote:
> I'm confused by my "ps aux" output. The owners of most processes are listed
> by name (as is typical).
>
> e.g.
> foouser  20644  0.0  0.0  90116  1924 ?        S    21:49   0:00 sshd:
> foouser@pts/7
>
> But there's one user who's always listed by her uid (512 in this case):
>
> 512      17068  0.0  0.0  90116  1876 ?        S    18:16   0:00 sshd:
> baruser@pts/3
>
> In the /etc/passwd file they look similar:
>
> foouser:x:502:100:foos Name:/home/foouser:/bin/bash
> baruser:x:512:100:bars Name:/home/baruser:/bin/bash
>
> What else could be causing this difference? I'm stumped!

Total shot in the dark here, but by any chance is there more than one
user name that maps to UID 512?

-- 
Bob Nichols         AT comcast.net I am "RNichols42"
0
Reply Robert 8/11/2010 5:40:36 PM

Robert Nichols <SEE_SIGNATURE@localhost.localdomain.invalid> wrote in 
news:i3unak$93t$1@omega-3a.local:

> Total shot in the dark here, but by any chance is there more than one
> user name that maps to UID 512?
> 

Nope! Just one. But I wonder what would happen if I did have two (although 
don't know what reason one could have to clash uid's but i've seen stranger 
things before! :) )

-- 
Rahul
0
Reply Rahul 8/11/2010 5:53:25 PM

J G Miller <miller@yoyo.ORG> wrote in news:i3un5f$8nm$3@news.eternal-
september.org:

> By ze vay, you do know that if you want to see the actual username rather
> than userid, you can create your own ps output format listing using
> the -o parameter.
> 

Nope, I didn't know. Thanks for the pointer.

The only way I've used ps is

ps aux

-- 
Rahul
0
Reply Rahul 8/11/2010 5:54:21 PM

On Wedinesday, August 11th, 2010 at 17:53:25h +0000, Rahul wrote:

> Robert Nichols <SEE_SIGNATURE@localhost.localdomain.invalid> wrote in
> news:i3unak$93t$1@omega-3a.local:
> 
>> Total shot in the dark here, but by any chance is there more than one
>> user name that maps to UID 512?
>> 
>> 
> Nope! Just one. But I wonder what would happen if I did have two
> (although don't know what reason one could have to clash uid's but i've
> seen stranger things before! :) )

I think you can have two usernames with the same uid (not a good idea though)
and ps would just show the first entry in /etc/passwd.

0
Reply J 8/11/2010 6:37:31 PM

J G Miller wrote:
> On Wedinesday, August 11th, 2010 at 17:53:25h +0000, Rahul wrote:
> 
>> Robert Nichols <SEE_SIGNATURE@localhost.localdomain.invalid> wrote in
>> news:i3unak$93t$1@omega-3a.local:
>>
>>> Total shot in the dark here, but by any chance is there more than one
>>> user name that maps to UID 512?
>>>
>>>
>> Nope! Just one. But I wonder what would happen if I did have two
>> (although don't know what reason one could have to clash uid's but i've
>> seen stranger things before! :) )
> 
> I think you can have two usernames with the same uid (not a good idea though)
> and ps would just show the first entry in /etc/passwd.
> 
Correct.
0
Reply The 8/11/2010 6:54:41 PM

J G Miller <miller@yoyo.ORG> writes:

> I think you can have two usernames with the same uid (not a good idea
> though) and ps would just show the first entry in /etc/passwd.

Standard configuration on some platforms.

    [richard@heceptor ~]$ head -4 /etc/passwd
    # $FreeBSD: src/etc/master.passwd,v 1.40.22.1.2.1 2009/10/25 01:10:29 kensmith Exp $
    #
    root:*:0:0:Charlie &:/root:/usr/local/bin/bash
    toor:*:0:0:Bourne-again Superuser:/root:

-- 
http://www.greenend.org.uk/rjk/
0
Reply Richard 8/11/2010 7:52:39 PM

9 Replies
1004 Views

(page loaded in 1.638 seconds)

Similiar Articles:











7/24/2012 8:36:54 AM


Reply: