Lab Information
In response to the latest tool implementation at xFusionCorp Industries, the system admins require the creation of a service user account. Here are the specifics:
Create a user named ammar in App Server 1 without a home directory.
Lab Solutions
π§ Part 1: Lab Step-by-Step Guidelines (Technical Execution)
πΉ Step 1: Log in to Jump Host
ssh thor@jump_host.stratos.xfusioncorp.com
Password:
mjolnir123
πΉ Step 2: SSH into App Server 1
ssh tony@stapp01.stratos.xfusioncorp.com
Password:
Ir0nM@n
πΉ Step 3: Switch to Root
sudo -i
πΉ Step 4: Create user ammar without a home directory
useradd -M ammar
πΉ Step 5: Verify the user exists
id ammar
πΉ Step 6: Confirm no home directory was created
ls -ld /home/ammar
Expected result:
No such file or directory
Also verify in passwd file:
grep ammar /etc/passwd
You should see a home path listed (usually /home/ammar), but the directory itself should NOT exist.
β Final Checklist
β User ammar created
β Created on App Server 1 only
β No home directory exists
β User verified successfully
π§ Part 2: Simple Step-by-Step Explanation (Beginner Friendly)
πΉ Why create a user without a home directory?
Service accounts often:
Run background tools
Do not log in interactively
Do not store personal files
Creating a home directory would be unnecessary and slightly less secure.
πΉ What does -M do?
-M tells Linux:
"Do NOT create a home directory."
If you omit -M, Linux automatically creates:
/home/ammar
πΉ Why verify after creation?
Labs are strict. Verification confirms:
The user exists (id ammar)
No directory was created (ls /home/ammar)
Requirement is fully satisfied
π Security Context
Service users:
Should have minimal privileges
Should not have unnecessary directories
Should only exist for process ownership
This keeps the attack surface smaller.
Top comments (0)