[Trilug-ontopic] sysadmin questions

Cristóbal Palmer cmp at cmpalmer.org
Fri Jun 11 20:28:04 EDT 2010

On Fri, Jun 11, 2010 at 7:30 PM, Richard O. Hammer <rhammer at fastmail.fm> wrote:
> What is the relationship between the user's group as designated in these two
> places:
>  1. in /etc/passwd in the fourth field in the line for a given user, and

Default group. When you create a new file, what group should it have?

>  2. in /etc/group, listed in the last field in the line for a given group?

users who are members of the group should show up on the line, but
putting them there by hand is bad practice. Use the nice system tools
that come with your distro to manage files like /etc/passwd and

> Can a user belong to several groups?  What command does the trick?

First add a user with adduser/useradd(8)

  sudo adduser someusername

Now add that user to additional groups with usermod(8)

  sudo usermod -a -Gsomegroup,someothergroup someusername

Lastly check the group memberships of that user with groups(1).

  sudo groups someusername

> Can a group belong to a group?  What command does this trick?

Can you give me a use case for this? If you really /need/ to do
strange hierarchical things, it's probably because you inherited a
silly, overly complex hierarchy from your large organization, in which
case you already have some flavor of LDAP you're connecting to. So you
either want to learn and use LDAP for the sake of learning it, or you
want to have some nice, simple Unix groups on this system you're

Please note: I'm disparaging LDAP and complex systems here because I
find it unlikely that you need the complexity that comes along with
LDAP, but I very much understand the value and need for things like
LDAP, and I put them to use in my work. I could be very wrong and you
in fact need the power and flexibility of LDAP.

Cristóbal M. Palmer
ibiblio.org systems
UNC Chapel Hill

More information about the Trilug-ontopic mailing list