How To: Linux Delete / Remove User Account Using userdel

You can use the userdel command to delete a user account on a Linux system. The userdel command is part of the shadow-utils package on many distributions, and it is used to manage user accounts and passwords.

Here’s how to use the userdel command to delete a user account:

  1. Log in as the root user.
  2. Run the following command, replacing username with the name of the user account you want to delete:
userdel username

This will remove the user account and its home directory, along with any files and directories it owns.

Note that if the user has any processes running, you will receive an error message. In that case, you need to first stop the user’s processes before you can delete the account.

If you want to keep the user’s home directory, you can use the -r option to skip the removal of the home directory:

userdel -r username

This will remove the user account but keep the home directory and its contents intact.

(https://stratnewsglobal.com/)

Leave a Comment