Delete obsolete user retired.
Also remove the user's home directory and mail spool.
Which command is appropriate?
userdel -r removes the account, home directory, and mail spool. Check backups and ownership before destructive removal.
Detailed explanation
userdel retiredIncorrect. Without -r, the home and mail spool normally remain.
userdel -r retiredCorrect. -r requests removal of the home directory and mail spool.
usermod -r retiredIncorrect. usermod changes an account rather than deleting it.
groupdel retiredIncorrect. groupdel removes a group, not a user account.
Try it yourself
An example you can run in a temporary verification environment.
userdel --help | grep -E -- '-r,|--remove'Expected result
ホームとメールスプールの削除を示す説明行Key points
- userdel removes the account
- -r removes related data
- Verify backups first
Notes
- Environment: shadow-utils userdel help / 状態変更なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Account record
Identity attributes such as a user ID, home directory, and login shell.
Group membership
Primary and supplementary groups used during permission checks.
Password aging
State and time limits that control password changes and account access.