LFCS · 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 removes the user 'bob' from the system's user database and also deletes their home directory along with their mail spool.
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
(61 responses)- A89% (54)
- C7% (4)
- D3% (2)
- E2% (1)
Why each option
The command `userdel --force --remove bob` removes the user 'bob' from the system's user database and also deletes their home directory along with their mail spool.
The `userdel` command's primary function is to remove a specified user's account entry from the `/etc/passwd`, `/etc/shadow`, and other relevant system user databases.
The `--remove` (or `-r`) option with `userdel` explicitly instructs the command to delete the user's home directory and mail spool, ensuring associated files are also cleaned up from the system.
The `locate` database is not automatically updated by `userdel`; it requires a separate `updatedb` command, which is typically run periodically by cron.
`userdel --remove` only deletes the home directory and mail spool; it does not scan all mounted filesystems to remove all files owned by the user, which would be a highly destructive action.
`userdel` does not automatically delete a group even if the user being deleted was the last member; group deletion must be done explicitly with `groupdel`.
Concept tested: User deletion options (userdel)
Source: https://linux.die.net/man/8/userdel
Topics
Community Discussion
No community discussion yet for this question.