How to add a System User Account on Linux (CentOS)

CentOSOn both CentOS and Red Hat Linux systems you can easily create new user accounts with their own home directories.

Here’s how you do this from the command line. I’m assuming you’re logged in as root, and the new user we’d like to create is called “testuser”:

useradd testuser

Let’s give our testuser a password so s/he can login to the system via SSH:

passwd testuser

This will prompt for a new password (twice), followed by the message that “all authentication tokens have been updated”. Which is nice.

You can now login as “testuser” with your designated password. Testuser’s home directory is located here:

/home/testuser

That’s all there’s to it – congratulations on creating a new user on your system ;-)

Removing a User Account

If you’re done with the account you can remove it with

userdel testuser

The data in this user’s home directory will still be intact, even when the user is removed. In case you’d like to do some house cleaning, you can pass -r which will remove the user’s directory and all contents he may have had:

userdel -r testuser

Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or drawing on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.