LX0-104 · Question #28
What is true regarding the command userdel --force --remove bob? (Choose TWO correct answers.)
The correct answer is A. The user bob is removed from the system's user database. B. The user bob's home directory is removed.. The command userdel --force --remove bob deletes the user account 'bob' from the system's database and removes their home directory along with its contents.
Question
Options
- AThe user bob is removed from the system's user database.
- BThe user bob's home directory is removed.
- CThe locate database is updated to drop files owned by bob.
- DAll files owned by bob are remove from all mounted filesystems.
- EIn case bob was the last member of a group, that group is deleted.
How the community answered
(57 responses)- A91% (52)
- C5% (3)
- D2% (1)
- E2% (1)
Why each option
The command `userdel --force --remove bob` deletes the user account 'bob' from the system's database and removes their home directory along with its contents.
The `userdel` command's primary function is to remove a user account entry from the system's user database files, such as /etc/passwd and /etc/shadow.
The `--remove` (or `-r`) option specifically instructs `userdel` to delete the user's home directory and mail spool, along with their contents, when removing the account.
The `locate` database is updated by the `updatedb` command, which is not automatically triggered by `userdel` and would not drop files specifically owned by the user.
The `userdel --remove` command only targets the home directory and mail spool; it does not scan all mounted filesystems to remove every single file owned by the deleted user.
`userdel` does not automatically delete groups, even if the user being removed was the last member of a supplementary group.
Concept tested: userdel command options
Source: https://man7.org/linux/man-pages/man8/userdel.8.html
Topics
Community Discussion
No community discussion yet for this question.