On Thu, 24 Nov 2005, Tim wrote:
On Wed, 2005-11-23 at 17:25 +0000, Dave Brown wrote:
I've noticed a bit of an interesting thing with regards to the
numbering of new users and groups when using the useradd and groupadd
(and luseradd / lgroupadd) commands.
Fresh system with no user accounts on it. Create a group called
"myfamily" using "groupadd myfamily" - the file /etc/group now has the
entry "myfamily:x:500". Create the user "brother" using "useradd
brother" - the file /etc/passwd now has
"brother:x:500:501::/home/brother:/bin/bash" and /etc/group has
"brother:x:501"
As you can see the utilities have created the user brother with a
userid of 500 and a groupid of 501. All the system accounts (and if
you created any users before you created the group) will have the
groupid equal to the userid. The unequal userid / groupid combo doesnt
cause a problem as the home directory permissions created for the user
are fine.
When I've just used the GUI tool, each new user has has the same UID and
GUI, each incrementing by one for each new user. But if I added a user
with a manual UID, using the GUI, the GID would automatically be one
higher than the last automatically generated GID. Using the CLI, they'd
both get the same GID and UID.
e.g. On a system with
Name UID GID
John 500 500
Martha 501 501
George 502 502
Fred 508 508
If I now added a new user via the GUI, leaving it to pick GID and UIDs,
they'd both be 503.
But if I added a new users using the GUI, opting to set the UID as 515,
it'd set the GID as 503 (the lowest free value).
But if I'd added them using the CLI (as 515, again), they'd both be 515.
I wish the GUI tool would either let me, also, set the GID, or set them
both the same as each other. It might well be that I want to add a few
usernames, but put them all into a guests group, for instance. I'd have
to do that via the command line (or a script).
sounds like the GUI tools arent using the UPG scheme where each user is in
their own group, not sure if it is a bug, but it seems like it probably
is. It just goes to show the command line is the best way to use an OS.