How to remove a user in Ubuntu?
To delete a user on Ubuntu, you can follow these steps:
- Use superuser privileges to log in to the system, or use the sudo command to perform the following tasks.
- Open the terminal.
- Use the following command to delete a user and their home directory:
sudo userdel -r <用户名>
The
- Please enter your password to confirm the operation.
- 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.