How To Create User in linux and Add Sudo Priveleges

In this short tutorial I will explain how to create a user in Linux and configure that user to have sudo privileges.

Step 1: Create the user using useradd command.

adduser username

Step 2: Setup password for the user using the passwd command.

passwd username

Step 3: Add the user to the wheel group. Once the user is added to the wheel group, it will have sudo privileges.

usermod -aG wheel username

Step 4: For passwordless sudo access you need to uncomment or add the NOPASSD entry in the sudoers file. Open the sudoers file using visudo and add the wheel entry,

%wheel  ALL=(ALL)       NOPASSWD: ALL

Now the user you created will have sudo access.