Deleting user on RHEL 8 / CentOS 8 Linux system can be accomplished using the
In this tutorial you will learn:
- How to delete user on RHEL 8 / CentOS 8.
- How to force user deletion.
- How to delete user as well as its home directory.
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|System||RHEL 8 / CentOS 8|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to delete user on RHEL 8 / CentOS 8 Linux step by step instructions
- Take a note of the user and its username you wish to remove.
You can list all system users by using the below
# cat /etc/passwd
- Use the
userdelcommand to remove a user. In this example we will remove a user with username
redhat-user. Please note the
-roption instructs the
userdelcommand to remove also user’s home directory:
# userdel -r redhat-user
- Use the
-foption to force the user removal in case the user is logged:
# userdel -f -r redhat-user