1

For a process,

  1. is its real user necessarily a member of its real group?

  2. Is its effective user necessarily a member of its effective group?

  3. is its real user necessarily a member of its effective group?

  4. Is its effective user necessarily a member of its real group?

If it matters, I am talking about Linux.

Thanks.

3
  • Why are user and group independent ? Intuitively I guess yes to at least first two. Commented Dec 30, 2016 at 14:11
  • don't comment on your self, add it to the question. Commented Dec 30, 2016 at 14:15
  • I notice that you have not accepted an answer: Did you get an answer, that you were looking for? Do you need more help? Commented Dec 23, 2018 at 22:47

1 Answer 1

5

No, no, no & no:

I will explain for uid ( it is same for gid) A process can move ID between effective, real, and other. A process can also arbitrarily set an ID if and only if it has capability CAP_SETUID.

Let us look at the way UID and GID are implemented:

There are both numbers stored in a database table (A file), both of these tables are independent. I have a UID, and a primary GID. Both called richard, but with different numbers. The only connections are: in /etc/passwd it lists username, UID, and primary GID. In /etc/group it lists groupname, GID, UIDs.

Most of the time these relationships are not checked, except: at login and when setgid is called (I think).

For efficiency only what is necessary is checked.

  • A process can move ID between effective, real, and other (file, saved).
  • A process can also arbitrarily set an ID if and only if it has capability CAP_SETUID.

--

From the man page for setreuid(),

setreuid() sets real and effective user IDs of the calling process.

Supplying a value of -1 for either the real or effective user ID forces the system to leave that ID unchanged.

Unprivileged processes may only set the effective user ID to the real user ID, the effective user ID, or the saved set-user-ID.

Unprivileged users may only set the real user ID to the real user ID or the effective user ID.

If the real user ID is set or the effective user ID is set to a value not equal to the previous real user ID, the saved set-user-ID will be set to the new effective user ID.

Completely analogously, setregid() sets real and effective group ID's of the calling process, and all of the above holds with "group" instead of "user".

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.