0

This is such an elementary question, and I can't believe I've been using Unix (Linux and Mac) for over 5 years without knowing this!

The root user has group id 0 and user id 0. Hence lower group ids have more permission. The question is, if I want to create an administrator group, where all members have the same rights as the root group, is that a safe practice? And do I create than by setting to the group id to 0? All this time I've been going along with sudo but that's because I've been the only user on my machine or vps.

Also, when a group id is say 10 or 100, can it perform any operation on any file that belongs to a group that say has an id of 1000? Is that how that's supposed to work?

Thanks,

Sam

3
  • 2
    You seem to have misunderstood something. You don't get "more" permissions by having a lower UID or GID, unless it happens to be 0 (root). Commented Sep 20, 2012 at 17:55
  • 1
    Look into the principal of the wheel group and read up on visudo and sudoers Commented Sep 20, 2012 at 17:58
  • You are confusing Unix/Linux operations with that old and venerable VAX system where userid numbering did determine native permissions. Yes, there were other ways to assign privs too.
    – mdpc
    Commented Sep 20, 2012 at 18:06

1 Answer 1

1

Each group in UNIX systems has its own unique ID. This is the primary identifier, the name is just some kind of alias.

In Unix systems, every user must be a member of at least one group, which is identified by the numeric GID of the user's entry in /etc/passwd. (from here)

The numerical value of the group ID is not in any way connected to the permissions of that group. Group ID 0 is a special case, as it's always the superuser group.

The question is, if I want to create an administrator group, where all members have the same rights as the root group, is that a safe practice? And do I create than by setting to the group id to 0?

Per sé this is not a safe practice. sudo has been invented for a reason. Modern distributions have a sudo or admin group. Add the user you want to use for admin tasks to this group.

1
  • Thanks. I'm using Ubuntu (for the last couple of years). What I had been doing is adding my user to the sudoers groups and just running commands with sudo. I thought there might be a better practice. When I edit /etc/sudoers can I specify a group instead of a user? Commented Sep 20, 2012 at 19:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .