Managing a system on Ubuntu often requires superuser privileges. If you're tired of googling "how to set up a superuser on Ubuntu" every time like me, here's a simple, step-by-step guide to get it done efficiently. Save this for future reference! I’m really just writing this for myself.
A superuser, often referred to as "root," is a user account with unrestricted access to all system files and commands. It's essential for administrative tasks like software installation, configuration changes, and file system management.
You can open the terminal using:
Ctrl + Alt + T (keyboard shortcut)
Searching for "Terminal" in the application menu.
If your current user already has sudo privileges, you can switch to the root account temporarily by typing:
sudo -i
You'll be prompted to enter your password. After this, you'll be logged in as the root user.
Add a new user by running:
sudo adduser username
Replace username with the desired username. You'll be prompted to set a password and provide optional details.
Grant the user sudo privileges:
sudo usermod -aG sudo username
Test the new superuser by switching to the account:
su - username
Then, try using sudo:
sudo apt update
If you want to enable the root account directly (not recommended for security reasons):
Set a password for the root account:
sudo passwd root
Enter and confirm the password.
To disable the root account later:
sudo passwd -l root
Use strong, unique passwords for all superuser accounts.
Limit sudo privileges to trusted users.
Regularly update your system to patch vulnerabilities:
sudo apt update && sudo apt upgrade
Here's a quick reference:
Add a user: sudo adduser username
Grant sudo privileges: sudo usermod -aG sudo username
Switch to root: sudo -i
Enable root (optional): sudo passwd root
With these steps, you'll always have a reliable superuser setup for your Ubuntu system. Bookmark this post or save it in your notes so you won't have to Google it again! 😊
A passionate developer with 5+ years of experience in web development. Specializing in React, TypeScript, and modern JavaScript frameworks.
View all posts by Prince Shammah