Re: useradd and the default group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13Apr2009 16:28, Carl D. Roth <roth@xxxxxxxxx> wrote:
| 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()'.

If you look at /etc/passwd you will see the gid field there is "mock"
(494). Eg:

  $ grep cameron /etc/passwd
  cameron:x:1000:1000::/home/cameron:/bin/zsh

The -g option to useradd specifies the primary group, which is recorded
in the passwd file, not the group file. A UNIX user has a primary group
which comes from the passwd file and secondary groups which come from
the group file. Absent the setgid bit on a directory, new files and
directories a process makes get their group ownership from the primary
group. _Access_ (open, cd, etc) is governed by uid and all the groups.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Drive Agressively  Rash Magnificently   - Nankai Leathers

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux