Bird
0
0

Why might userdel -r fail to remove a user's home directory even when run as root?

hard📝 Conceptual Q10 of 15
Linux CLI - Users and Groups
Why might userdel -r fail to remove a user's home directory even when run as root?
AThe user's shell is /bin/false
BThe home directory has immutable attribute set
CThe user account is locked
DThe user is currently logged in
Step-by-Step Solution
Solution:
  1. Step 1: Understand filesystem attributes

    If the home directory has the immutable attribute set (chattr +i), even root cannot delete it without removing the attribute first.
  2. Step 2: Analyze other options

    User login status or account lock does not prevent directory deletion. Shell type does not affect file removal.
  3. Final Answer:

    The home directory has immutable attribute set -> Option B
  4. Quick Check:

    Immutable attribute blocks deletion even by root [OK]
Quick Trick: Check immutable attribute if userdel -r fails to delete home [OK]
Common Mistakes:
  • Assuming logged-in user blocks deletion
  • Confusing account lock with file deletion
  • Thinking shell type affects deletion

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes