ps, systat vs top shows different process owner?

Jeremy Chadwick freebsd at jdc.parodius.com
Fri Dec 2 15:24:05 UTC 2011


On Fri, Dec 02, 2011 at 03:26:08PM +0100, Bartosz Stec wrote:
> Hi list,
> I have a SAMBA server (version 3.5.11) installed over 8.2-STABLE. I
> have just noticed, that top shows USERNAME of all smbd processes as
> root, while systat and ps show user logged to SAMBA.
> 
> ps output of example user:
> 
>    # ps -a -U foo.bar
>       PID  TT  STAT      TIME COMMAND
>    19731  ??  S      0:10,19 /usr/local/sbin/smbd -D -s
>    /usr/local/etc/smb.conf
> 
> 
> top output for the same PID:
> 
>    # top -d1 | grep 19731
>    19731 root               1  44    0 17220K  7844K select   0:12
> 0.29% smbd
> 
> systat output is consistent with ps.
> 
> Is that expected behaviour? Could someone explain it to me?

Windows XP client, FreeBSD server.  XP client is logged in to SMB/CIFS
share, authenticated locally (pdbedit database), as user "jdc".  UNIX
username is also "jdc".

$ ps -auxw | grep smbd
root     1407  0.0  0.1 27528  6832  ??  Is   Thu05AM   0:00.16 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
root     1459  0.0  0.1 27528  6788  ??  I    Thu05AM   0:00.01 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
root     2421  0.0  0.1 27912  7716  ??  S    Thu06AM   0:00.29 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
root    17131  0.0  0.1 27948  8104  ??  S     9:07PM   0:05.64 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf

$ ps -a -U root | grep smbd
 1407  ??  Is     0:00.16 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
 1459  ??  I      0:00.01 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
 2421  ??  I      0:00.29 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
17131  ??  S      0:05.64 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf

$ top -b 10000000 | grep smbd
17131 root         1  44    0 27948K  8104K select  0   0:06  0.00% /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
 2421 root         1  44    0 27912K  7716K select  1   0:00  0.00% /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
 1407 root         1  44    0 27528K  6832K select  1   0:00  0.00% /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
 1459 root         1  44    0 27528K  6788K select  1   0:00  0.00% /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf

Note that in top output, I use environment variable TOP="-a -s 1", just
an FYI.  Also be warned about top: the -b flag will result in your
terminal window losing ECHO and ICANON capability; you will need to
issue "stty echo icanon" to fix it every time; this is a bug in top:
http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/161739

But as you can see, there are no smbd processes running as UNIX user
jdc:

$ ps -a -U jdc | grep smbd
jdc  28599  0.0  0.0  9100  1500   1  S+    7:21AM   0:00.00 grep smbd

I use smbpass/pdbedit for my SMB<-->UNIX correlation database:

# pdbedit -u jdc
jdc:1000:Jeremy Chadwick

Versions of things:

$ pkg_info | grep samba
samba36-3.6.1       A free SMB and CIFS client and server for UNIX

$ uname -a
FreeBSD icarus.home.lan 8.2-STABLE FreeBSD 8.2-STABLE #0: Thu Dec  1 04:37:29 PST 2011 root at icarus.home.lan:/usr/obj/usr/src/sys/X7SBA_RELENG_8_amd64  amd64

Finally, how does systat play into this?  I do not know how to get
systat to show usernames for anything; did you mean a different utility?

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                   Mountain View, CA, US |
| Making life hard for others since 1977.               PGP 4BD6C0CB |



More information about the freebsd-stable mailing list