Skip to content

Create a new user and add to a group in CentOS / Ubuntu / Linuxmint

Learn how to create a new user and add the user to a group in CentOS / Ubuntu / Linuxmint distributions of Linux.

Before you start creating users and groups, you need sudo access. Either login as root or use sudo with every command.

To create a new user we use adduser command.

sudo adduser clouduser

Create a password for the user.

sudo passwd clouduser

New password: 
BAD PASSWORD: The password is shorter than 7 characters
Retype new password: 
passwd: all authentication tokens updated successfully.

When a user is created a group is automatically created with the same name. But if you want to assign the user with a different group, you can use the following commands.

//Creating a new group with groupadd command
sudo groupadd clouduser

//usermod command to assign a group to a user
usermod -a -G clouduser clouduser

You can now try logging in with the newly created user.

su - clouduser
Password: 

Leave a Reply

Your email address will not be published. Required fields are marked *

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