How to get the euid of a process?

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,args

The 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).

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like