gextra gextra - 1 year ago 102
Linux Question

Is there a way to identify the user who owns a process from /proc/PID

I am parsing process details out of

and I am so far unable to find who owns a process from that meta directory's files.

Documentation does not seem to point to that info as well:

Answer Source

The owner of the process is the owner of all files in the /proc/PID directory.

$ ls -l /proc/27595
total 0
dr-xr-xr-x   2 me users 0 Jul 14 11:53 attr
-r--------   1 me users 0 Jul 14 11:53 auxv

Also the file /proc/PID/loginuid holds the UID of the owner of the process.

$ cat /proc/27595/loginuid
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download