Study guide
5.2 Creating Users and Groups
LPI Linux Essentials Certificate 010-160
Track your progress as you read
Finished sections get a check mark.
1 Introduction & Exam Overview
1.1 Current Exam Facts 1.2 Study Strategy & Blueprint Weights
2 Topic 1: The Linux Community and a Career in Open Source
1.1 Linux Evolution and Popular Operating Systems 1.2 Major Open Source Applications 1.3 Open Source Software and Licensing 1.4 ICT Skills and Working in Linux
3 Topic 2 Part A: Command Line Basics & Getting Help
2.1a Bash Shell, Command Syntax & Variables 2.1b Quoting, History & Safe Command Syntax 2.2 Using the Command Line to Get Help
4 Topic 2 Part B: Directories, Listing & File Operations
2.3 Using Directories and Listing Files 2.4 Creating, Moving and Deleting Files
5 Topic 3 Part A: Archiving & Searching Data
3.1 Archiving and Compression on the Command Line 3.2a Pipes, Redirection, and Basic Regular Expressions 3.2b grep and Text Extraction Tools
6 Topic 3 Part B: Turning Commands into Scripts
3.3a Script Basics: Shebang, Variables, and Arguments 3.3b Loops, Exit Status, and Simple Conditionals 3.3c Editors, chmod +x, and Running Scripts
7 Topic 4 Part A: Choosing an OS, Hardware & FHS Basics
4.1 Choosing an Operating System 4.2 Understanding Computer Hardware 4.3a Where Programs and Configuration Live (FHS Basics)
8 Topic 4 Part B: Processes, Logs & Networking
4.3b Processes, Memory & Logs 4.4 Your Computer on the Network
9 Topic 5: Security and File Permissions
5.1 Basic Security and Identifying User Types 5.2 Creating Users and Groups 5.3 Managing File Permissions and Ownership 5.4 Special Directories and Files
5.2 Creating Users and Groups
Key Takeaways Explain This Topic AI
useradd creates accounts; groupadd creates groups; passwd sets or changes a user’s password
New home directories are often seeded from files in /etc/skel so every user starts with the same starter configs
UIDs uniquely identify users; GIDs identify groups—names are labels mapped to those numbers
Human users typically receive UIDs from a high range (commonly starting at 1000); system accounts use lower UIDs
- After creating an account, set a password with passwd before expecting interactive password logins
- Last updated: July 2026
5.2 Creating Users and Groups
Once you can identify account types and the /etc databases, the next Essentials skill is creating users and groups safely. You do not need every obscure useradd flag, but you must know the core commands, what a new account needs before login works, and how UID/GID numbering fits the picture.
Creating a user with useradd
The useradd command adds a new entry to the account databases (and, depending on options and distro defaults, may create a home directory). sudo useradd -m -s /bin/bash maya
sudo passwd maya
- Common option Purpose
- m Create the user’s home directory
- s /bin/bash Set the login shell
- g groupname Set the primary group
- G group1,group2 Add supplementary groups
- u 1050 Force a specific UID (use carefully)
- c "Maya Lopez" Set the GECOS/comment field
Distro defaults differ: some systems create a matching private group (UID=GID naming), others place new users in a shared users group. For the exam, focus on useradd creates the account record , and -m ensures a home directory . Without -m , you may get a passwd entry but no /home/username until you create it yourself.
Worked example: An instructor adds a lab account: sudo useradd -m -s /bin/bash lab22 sudo passwd lab22 Until passwd succeeds, password-based login for lab22 fails even though the account exists in /etc/passwd .
- Worked walkthrough: useradd → /etc/passwd fields
- Map each flag to the colon-separated passwd line so you can predict the result: sudo groupadd -g 1600 studio
- sudo useradd -m -u 1105 -g studio -G designers,video -c "Maya Lopez" -s /bin/bash maya
Resulting line (field order):
maya:x:1105:1600:Maya Lopez:/home/maya:/bin/bash
- useradd piece Passwd field
- maya 1 — username
- (system writes x ) 2 — placeholder → /etc/shadow
- u 1105 3 — UID
- g studio (GID 1600) 4 — primary GID
- c "Maya Lopez" 5 — GECOS
- m → /home/maya 6 — home
- s /bin/bash 7 — shell
- G designers,video Not in passwd — supplementary groups in /etc/group
Verify with id maya (uid, gid, groups) and ls -ld /home/maya . If -G was omitted, only the primary group appears. If -m was omitted, the home directory may be missing even when field 6 names a path. Run getent passwd maya as another quick confirmation that the account record landed.
Setting passwords with passwd
- Invocation Who it affects
- passwd Changes your password
- sudo passwd alice Root (via sudo) sets alice ’s password
passwd updates /etc/shadow . Essentials cares about the workflow : create account → set password → user can log in. Password management is separate from merely adding a username.
- Creating groups with groupadd sudo groupadd designers
- sudo useradd -m -s /bin/bash sam -G designers
groupadd creates a new GID in /etc/group . Attach users with useradd -G or later membership changes ( usermod -aG on many systems). Shared project directories often rely on a common group so members collaborate without sharing one login.
- Command Creates
- useradd User account (UID)
- groupadd Group (GID)
- passwd Password hash / credentials
- /etc/skel — the new-home template
When useradd -m creates a home, it typically copies files from /etc/skel (for example .bashrc , .profile ) into /home/username/ .
Worked check: If /etc/skel/.bashrc exists and you run sudo useradd -m demo , expect /home/demo/.bashrc owned by demo . Missing starters → check skel and whether -m was used. A class README placed in skel is copied to every later new home.
UIDs and GIDs: numbers are the real identity
Linux stores ownership as numbers . Recreating username alice with a different UID leaves old files tied to the previous number (or a numeric owner if the name mapping is gone).
- Kind of account Usual UID range (common pattern)
- Root 0
- System / service Low range (often 1–999 )
- Regular human users High range (often 1000+ )
Human users are not UID 0 and usually sit above the system range; exact UID_MIN values vary by distro.
Practical creation checklist
Human account (home + shell) vs system-style (often no login shell).
groupadd first if you need a project GID.
useradd -m ... with primary/supplementary groups as required.
- passwd , then verify with id username . sudo groupadd projectx
- sudo useradd -m -s /bin/bash -G projectx kai
- sudo passwd kai
- id kai
- Common mistakes to avoid on the exam
Creating a user but forgetting passwd .
Forgetting -m when a home is expected.
Confusing /etc/skel (template) with /etc/shadow (hashes).
Assuming the username string alone owns files forever— UID is what the filesystem stores.
Topic 5.2 creates identities; Topic 5.3 applies them with chmod / chown . A wrong UID at creation becomes a wrong owner later.