Creating Linux users, groups, and adding them to the group…

Adding a Linux user is a pretty simple task. You will either need root access, or be part of the sudoers. This tutorial is written as if you have root access.

First, you want to create a user:

# useradd yourusername

Next, set a password for that user:

# passwd yourusername
Changing password for user yourusername.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

You can see here that when you run the passwd command for your new user, it will ask you for a password, confirmation, and then give you a success message (or fail).

Your user is set, now let’s get them in a group. Create your group:

# groupadd developers

This will create a group named ‘developers’. You can call your group anything you want.

The last step is to add your user to your group. In our instance, the user is already created, so we’re going to modify the user:

# usermod -a -G developers yourusername

Alternatively, you could skip the useradd at the beginning, create the group first, and do:

# useradd -G developers yourusername

That’s all there is to it. If you want to read more on the Linux command line, check out this book:

The Linux Command Line: A Complete Introduction


Written by Dan
Welcome to my blog! Here you'll find my collection of bible study lessons, book reviews, and other posts I feel inspired to write. I am a Christian currently serving at First Baptist Church of Northville in Northville, MI.