How to Remove a Linux User Updated on August 16, 2021 by InMotion Hosting Contributor 1 Minutes, 33 Seconds to Read You need to know how to remove a Linux user you create on an operating system (OS): CentOS, Debian, Ubuntu, etc. Hopefully, you’re using other user management controls such as least privilege and “need to know” already. Removing unneeded Linux users is an easy way to secure your cloud server from unauthorized access when someone takes a mandatory vacation or is terminated from your organization. Below we’ll cover how to remove a Linux user on CentOS, Debian, and Ubuntu. If you don’t need cPanel, don't pay for it. Only pay for what you need with our scalable Cloud VPS Hosting. CentOS, Debian, or Ubuntu No Bloatware SSH and Root Access Remove a Linux User Log into SSH as root.Prevent the user from being able to login and start new processes: sudo passwd --lock user1You may receive a notification stating “passwd: password expiry information changed.”Kill the user’s processes with one of the following commands: sudo pkill -KILL -u user1sudo killall -9 -u user1Ensure the user is no longer running any processes. You can use many process managers such asps -aux, top, or htop.(Optional) You may benefit from archiving the user directory before removing it. In other cases, it may be better to simply create a server snapshot or full backup instead. You should also recommend the user to backup their own data from the server and to a PC backup solution for their own safekeeping.Check for cron jobs maintained by the user: sudo crontab -u user1 -lRemove the user’s cron jobs: sudo crontab -r -u user1Finally, remove the user’s files on the system. The recommended command depends on your Linux distribution.CentOS and Arch (remove the CentOS user’s home directory): sudo userdel --remove user1 sudo userdel -r user1Remove the user account even if it’s logged in and has processes running: sudo userdel -f user1 sudo userdel --force user1Debian: sudo deluser --remove-home user1 Learn more about server management with our Cloud Server Product Guide. Share this Article InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles How to Change Your Server SSH Port cPanel vs Other Web Hosting Control Panels How To Manage SSH Keys for Your Server Install Webmin on Ubuntu 20.04 How to Re-OS Your Cloud Server in AMP Choosing Vesta Control Panel How to Log into Webmin and Update Passwords Adding a User and Domain to Vesta Control Panel How to Add a BIMI Record on Cloud Server Hosting How to Install PHP on a Linux Cloud Server