Options Available in `userdel` Command
Option |
Description |
---|---|
-f |
Force removal of the user account, including home directory and mail spool, even if the user is logged in. |
-r |
Remove the user’s home directory along with the account. Useful for a complete cleanup. |
-h |
Display a help message and exit, providing information on command syntax and available options. |
-R |
Apply changes in the specified CHROOT_DIR, useful for user deletion operations within a chroot environment. |
-Z |
Remove SELinux user mapping for the user’s login, applicable in SELinux-enabled systems. |
-help |
Display a help message with the general syntax and available options for the userdel command. |
How to Delete User in Linux | userdel Command
Managing user accounts is an essential aspect of Linux system administration. Whether you need to remove an unused account, revoke access for a departing employee, or clean up your system for security reasons, understanding how to delete a user in Linux is a crucial skill. In this guide, we will explore the userdel command, a powerful tool in Linux for removing user accounts.
Table of Content
- How to Delete User in Linux using `userdel` Command
- Options Available in `userdel` Command
- Pratical Implementaion of How to Delete User in Linux
- 1. How to Delete User in Linux
- 2. How to Forcely Delete User in Linux
- 3. How to Delete User in Linux with Home Directory and Mail Spool
- 4. Display Help Message and Exit
- 5. Apply Changes in CHROOT_DIR
- 6. Remove SELinux User Mapping
- 7. User Deletion with Help Option
- Frequently Asked Questions