Is there a way to get the euid (effective user ID) of a process in Ubuntu without installing any software?
1 Answer
The user returned by ps (eg in ps aux or ps -ef) is the effective user by default. If you want the effective user id as well you need to add uid to the format line, for example:
ps -eo pid,user,uid,argsThe above will show the effective user ID after the effective user name. Note that euser and euid are just aliases of user and uid respectively.
These are distinct to the real user and real user id which would require adding ruser and ruid in the ps format line. Typically, effective user (the default) is what you want. Real user is mainly just a mechanism to remember the original uid before changing uid using setuid (the mechanism used by sudo and su).