Sometimes you need to create a new user on your Linux system and grant them administrative (sudo) privileges. This guide walks you through the process safely.
Step 1: Create a New User
We are going to use a friendly tool called adduser to create new users.
sudo adduser username
Replace username with your desired username (e.g., netrunner).
You will be prompted to:
-
Enter a password for the new user
-
Optionally fill in details like Full Name, Room Number, etc. (can be skipped)
Tip:
adduseris recommended overuseraddbecause it automatically sets up the user’s home directory and permissions.
Step 2: Add the User to the sudo Group
Any user in the sudo group can run administrative commands.
sudo usermod -aG sudo username
-
-aGmeans “append the user to this group without removing them from other groups.” -
You can also add the user to the group during creation:
sudo adduser username sudo
Step 3: Verify Sudo Access
Switch to the new user:
su - username
Then test sudo:
sudo whoami
You should see:
root
This confirms the user has sudo privileges.