How to Remove (Delete) a User on Ubuntu 16.04
User management includes removing users who no longer need access, removing their username and any associate root privileges are necessary for securing your Ubuntu based Cloud VPS server. Deleting a user’s access to your Linux server is a typical operation which can easily be performed using a few commands.
Pre-flight Check
- We are logged in as root on an Ubuntu 16.04 VPS powered by Liquid Web!
Delete A User
Step 1: Remove the User
Insert the username you want to delete by placing it after the userdel command. In our example, I’ll be deleting our user, Tom.
userdel tom
Simultaneous you can delete the user and the files owned by this user with the -r flag. Be careful these files are not needed to run any application within your server.
userdel -r tom
If the above code produces the message below, don’t be alarmed, it is not an error, but rather /home/tom existed but /var/mail/tom did not.
userdel: tom mail spool (/var/mail/tom) not found
Step 2: Remove Root Privileges
By removing Tom’s username from our Linux system we are halfway complete, but we still need to remove their root privileges.
visudo
Navigate to the following section:
## Allow root to run any commands anywhere
root ALL=(ALL:ALL) ALL
tom ALL=(ALL:ALL) ALL
Or:
## User privilege specification
root ALL=(ALL:ALL) ALL
tom ALL=(ALL:ALL) ALL
With either result, remove access for your user by deleting the corresponding entry:
tom ALL=(ALL:ALL) ALL
Save and exit this file by typing :wq and press the enter key.
To add a user, see our frequently used article, How to Add a User and Grant Root Privileges on Ubuntu 16.04. Are you using a different Ubuntu version? We’ve got you covered, check out our Knowledge Base to find your version.
Related Articles:

About the Author: Echo Diaz
Throughout Echo's four year stint as a technical support specialist, her passion for breaking down complex concepts had to lead to a career in professional writing. As a former top tier support specialist, she added a distinctive element to her written work that spoke to customer feedback and concerns. Echo occasionally pops her head out from behind her computer to watch her dog energetically run around the yard and unabashedly shovels money into buying tickets to see her favorite musical artists.
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
Latest Articles
2024 cPanel and Plesk pricing breakdown
Read ArticleCentOS Linux 7 EOL — everything you need to know
Read ArticleHow to install Node.js on Linux (AlmaLinux)
Read ArticleUpgrading or installing PHP on Ubuntu — PHP 7.2 and Ubuntu 22.04
Read ArticleWhy is your IP blocked?
Read Article