useradd and the default group

Carl D. Roth roth at ursus.net
Mon Apr 13 16:28:36 UTC 2009


Can some one explain the following weird behavior with useradd?

  # useradd -g mock -r -m -d /var/lib/mockuser mockuser

  --> create a new 'mockuser' user that can be used to run /usr/bin/mock

  # id mockuser
  uid=494(mockuser) gid=491(mock) groups=491(mock)

  # grep mock /etc/group
  mock:x:491:roth

Hm, that's interesting, 'mockuser' is not in the 'mock' group.  This can 
be verified using 'getgrent()'.

  # usermod -G mock mockuser

  --> seems redundant...

  # id mockuser
  uid=494(mockuser) gid=491(mock) groups=491(mock)

  --> group membership did not change

  # grep mock /etc/group
  mock:x:491:roth,mockuser

  --> but the group's membership list did change

Thanks!




More information about the fedora-list mailing list