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

- by

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


If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.