I'm learning UNIX file permissions / ID inheritance and would like to clarify something:

I have this list of permissions, users, groups and files:

-rwxr-xr-x userA  A   foo
-rw-rwsr-x userB  B   bar
  • RealUID of userA is 100, GroupID of userA is 240
  • RealUID of userB is 102, GroupID of userB is 241

I need to know what would happen if userB executes foo:

  1. Does userB's RealUID change to userA's RealUID?

  2. Does userB's EffectiveUID change to userA's EffectiveUID?

Since userB is executing a file of userA, does userB's RealUID get saved into SavedUID, then after executing, it reverts back to normal?

Does executing file also changes userB's GroupID?

  • User or Group are just records in the user database, the kernel doesn't care about it. What process care, is crendentials of a process, including RealUID and EffectiveUID and other things. – 炸鱼薯条德里克 Jan 15 at 5:39

Well, for starters, users don't have RealUIDs.  Users have UIDs. Period.  (The situation with GIDs is a little more complex.)

Processes have real UIDs and effective UIDs (and more).

Secondly, executing a file will never change the real UID or the real GID of a process.

Thirdly, executing foo will not change any of a process's IDs, because it does not have the setUID or the setGID bit set in its mode.

And why have you bothered to stipulate a file bar that does have the setGID bit set in its mode, when you don't ask any questions about it?

Please do some more research and edit your question to be more coherent.

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.