RHEL Linux - Red Hat System Administration Practice Exam

Disable ads (and more) with a membership for a one time $4.99 payment

Study for the RHEL Linux - Red Hat System Administration Exam. Enhance your knowledge with flashcards and multiple-choice questions, complete with hints and explanations. Prepare for your certification!

Practice this question and more.


Which command can be used to remove a user from /etc/passwd while leaving their home directory intact?

  1. userdel -r

  2. deleteuser

  3. userdel

  4. usermod -d

The correct answer is: userdel

The command used to remove a user from the system while leaving their home directory intact is `userdel`. This command effectively removes the specified user account from the `/etc/passwd` file, which is essential for managing user accounts in Linux. When `userdel` is executed without the `-r` option, it only removes the user's account information and does not delete the user's home directory or any files contained within it. This behavior is particularly useful in scenarios where you want to preserve user data or the home directory for potential future use or to maintain data integrity. In contrast, the `userdel -r` command would remove both the user account and their home directory, which does not align with the requirement of keeping the home directory intact. The other options, such as `deleteuser` and `usermod -d`, are either not standard commands in most RHEL systems or serve different purposes related to user account management. Thus, `userdel` is the most appropriate choice for removing a user while retaining their home directory.