How to remove a user in Ubuntu?

To delete a user on Ubuntu, you can follow these steps:

  1. Use superuser privileges to log in to the system, or use the sudo command to perform the following tasks.
  2. Open the terminal.
  3. Use the following command to delete a user and their home directory:
sudo userdel -r <用户名>

The is the username of the user to be deleted. Using the -r option will also delete the user’s home directory.

  1. Please enter your password to confirm the operation.
  2. To verify that the user has been successfully deleted, you can view the list of users on the system by entering the following command:
cat /etc/passwd

This command will list all users and their related information, to confirm that the user is no longer present.

Please note that deleting a user is a sensitive operation, so please proceed with caution to avoid accidentally deleting other important users.

bannerAds