How to add a root user to Ubuntu
Enjoying this content? Subscribe to the Channel!
Mastering Ubuntu: How to Add a New Sudo (Root Level) User Quickly!
Hi there, this is Darren O’Neill from Darren’s Tech Tutorials, and I’m excited to walk you through a foundational skill for managing any Linux system: adding a new user and granting them administrative or “root-level” permissions.
If you’re coming from Windows, think of this new user as an ‘Administrator.’ In the world of Ubuntu and Linux, this powerful access is achieved by adding the user to the special ‘sudo’ group. This is essential for system maintenance, installing software, and ensuring secure compartmentalization of tasks.
Don’t worry—this process is surprisingly easy. Let’s jump right in!
Step 1: Opening Your Terminal
Before we start typing commands, we need to access the command line interface.
- Click on Activities in the upper left corner of your screen.
- Search for and open the Terminal.
With the Terminal open, we can begin the user creation process.
Step 2: Creating the New User Account
We will use the adduser command, prefixed by sudo (which allows us to run the command with elevated privileges). For this example, we’ll create a user named ‘joe’.
Type the following command into your terminal and press Enter:
sudo adduser joe
You will immediately be prompted for your current admin password to verify that you have the permission to create a new user.
Setting Up the New User
After entering your password, the system will walk you through the setup process for the new user:
- Enter a New Password: Type a strong password for the new user, and then retype it to confirm.
- User Information: The system will ask for optional details like Full Name, Room Number, Work Phone, etc. You can fill these out or simply press Enter to leave them blank, as we did in the tutorial.
- Confirmation: Finally, confirm that the information is correct by typing
Yand pressing Enter.
The user ‘joe’ is now created! However, they currently only have basic user permissions. We need to elevate their status.
Step 3: Granting Root (Sudo) Permissions
This is the most crucial step. To give the new user ‘joe’ the same administrative rights as the primary admin user, we need to add them to the sudo group. Members of this group can run commands with sudo access (i.e., root access).
We use the usermod command to modify the user’s attributes:
sudo usermod -aG sudo joe
Let’s quickly break down this command:
usermod: The utility used to modify a user account.-a: Appends the user to the specified group(s).-G: Specifies the group(s) to add the user to.sudo: The name of the group that grants administrative access.joe: The username being modified.
Once you execute this command, ‘joe’ now has full root privileges!
Step 4: Verifying the New Sudo User
It’s always best practice to confirm that your changes worked correctly. We will now switch users and test the administrative rights.
We use the su command (switch user) to log in as the new account:
su joe
When prompted, enter the new password you created for ‘joe’.
You should see your prompt change, indicating that you are now logged in as joe.
Testing Root Access
To ensure ‘joe’ can successfully run commands requiring admin access, let’s try to run a simple, privileged command like listing the root directory (which usually requires sudo).
sudo ls /root
The system should ask you for ‘joe’s’ password one final time before executing the command. If the command runs without error, then congratulations—your new user ‘joe’ has been successfully granted root/sudo permissions!
Conclusion
That was a very quick, efficient tutorial on how to add a new user and ensure they have full administrative permissions on your Ubuntu machine. This simple process is vital for system security and proper user management.
If this guide was helpful, please give this post a share! Don’t forget to Like the video, Subscribe to Darren’s Tech Tutorials for more clear, actionable guides, and drop a comment below if you have any questions. Thanks for watching, and happy computing!