How to: Create New Users and Grant Sudo Privileges to Users on Linux


When working with any Unix machine, it is recommended to run commands as a sub-user, and only to use root when necessary. This means that a basic knowledge of how to create new users and give them proper permissions is required. Here is a step-by-step guide on how to create new users on Linux, how to add a password to those users.

 CREATING NEW USERS ON LINUX

The first step is to create a new user if you haven’t already done so.

To create a new user run

adduser username


This will begin a series of prompts including password and profile information for the new user.

It is not safe to be operating your VM as root, so in order to make changes from a created user, you need to grant root or sudo privileges to created users.

GRANTING ROOT OR SUDO PRIVILEGES TO USERS

To grant root privileges for a user on Ubuntu or Debian run 

usermod -a -G sudo username


To grant root privileges for a user on CentOS or RedHat run 

usermod -a -G wheel username


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.