Step #1: Delete the User

If you want to remove the user and all of the user’s files as well, you can include the “-r” flag:

userdel -r newuser

Note: Before removing a user’s files, please be certain that they won’t be needed again, as the files will not be recoverable. If in doubt, first back up the files by moving them to another location or downloading them locally first.

Step 2: Remove the User’s Root Privileges

Run the command:

visudo

And find the following code:

## Allow root to run any commands anywhere root ALL=(ALL) ALL newuser ALL=(ALL) ALL

In this case, we’re removing root privileges from the user “newuser”, so remove the following line: