Need help? Chat now!
Search results for:
Table of Contents
Tags: CentOS Web Panel
You may find that at some point, you have a user account that is no longer needed and needs to be removed from your server. Perhaps a contractor that you have hired has completed their work, or it is simply a test account that has served its purpose. Regardless of the circumstance, you can delete any unnecessary user's from your server. In this article, we will show you how to delete user accounts on a CentOS 7 server.
Deleting a user in CentOS 7 is a very simple and straightforward process. However, before we begin, you'll need to go ahead and log in to your server via SSH. If this is not something that you're familiar with, never fear Hostwinds has you covered! You can refer to the following article, which covers Connecting to Your Server via SSH. There are a few methods that you can utilize to remove a user's account you can use depending on your situation.
Say, for example, you'd like to remove the user's account username_to_delete_here, but you'd like to keep the files associated with their account. You'd use the following as the root or sudo user. If you're using a sudo user please ensure that you add sudo before the command:
This would remove the actual user, preventing them from accessing your server using the login credentials associated with that account, but keep all of their files.
If you wanted to remove all files from username_to_delete_here, including their home directory and the user account itself, you could do so via the following command issued as the root or sudo user. If you're using a sudo user, please ensure that you add sudo before the command:
userdel -r username_to_delete_here
This would effectively and remove all traces of the user from your server. Please note that without a backup, the files are permanently removed.
Written by Michael Brower / June 22, 2017