I'm trying to get an existing application running under SELinux which is causing endless pain. Matters would be eased somewhat if I knew what contexts the various components were running in - users have contexts, files have contexts but it seems that a process can also have a context which is only loosely related to the user and file (by an arbitrary set of rules in the policy).

Making some sense of the morass wold be facilitated if I knew what context a process was executing in - is there a command providing this as part of a standard installation?

I could look for the current process id in the output of ps auxZ, but these seems a somewhat ugly solution.

1 Answer 1


You can use id -Z or getpidcon $$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.