Tracy_Baker
Starfighter Starfighter
Starfighter
  • 365 Views

Incorrect explanation in RH124 (v9) chapter 6, section 5

This text, in RH124 (v9), Chaper 6, section 5, is incorrect:

In Red Hat Enterprise Linux 9, the useradd command assigns new users the first free UID that is greater than or equal to 1000, unless you explicitly specify one by using the -u option.

useradd does not do this. The UID it automatically assigns is one greater than the greatest one in use - or 1000 if no regular user exists in the system.

For example:

/etc/passwd has cloud-user as the user with the greatest UID (1002), there are none greater.

I do this: useradd -u 30000 bob

now bob has the greatest UID at 30000

Then this:

useradd kate

According to the text, this should happen, "assigns new users the first free UID that is greater than or equal to 1000", meaning the first free one greater than 1000 should be 1003 since it isn't being used.

What really happens is that kate will get 30001 - one more than the greatest one.

This will leave 1003 through 29999 unused unless the UID is specifically set by the useradd or usermod commands (or all users greater than 1003 are deleted or renumbered).

Incidental point #1: This effect first appeared in RHEL 8.
Incidental point #2: groupadd works the same way.

 

Program Lead at Arizona's first Red Hat Academy, est. 2005
Estrella Mountain Community College
Labels (3)
0 Kudos
0 Replies
Join the discussion
You must log in to join this conversation.