Chapter 4: Manage Users Across Multiple Linux Servers with Consistent UIDs
In this chapter, you'll learn how to create Linux users and groups with the same UIDs and GIDs on every server, script it safely, verify it with getent, and offboard users properly.
When you create the same user manually on several Linux servers, that account can end up with a different numeric user ID on each machine.
At first, everything may look normal because the username is the same, but Linux tracks file ownership by UID and GID rather than by the account name itself.
In this chapter, we'll create a team group and several user accounts with fixed IDs on both Ubuntu and Rocky Linux.
What You'll Learn
By the end of this chapter, you'll know how to:
- Understand why Linux identifies users and groups by numeric UID and GID values.
- Choose a UID and GID range that does not conflict with existing local accounts.
- Create groups and users with fixed IDs using
groupaddanduseradd. - Handle command differences between Ubuntu and Rocky Linux where necessary.
- Write a reusable script to create the same users on multiple servers.
- Verify user and group information with
getent. - Lock, expire, and remove user accounts when someone leaves the team.
Why Users Need the Same UID on Every Server
Updated on Oct 9, 2026