I recently turned my unused home PC into a fully functional Ubuntu Server—it has 64GB of RAM and an RTX 2060 SUPER, which made it perfect for self-hosted services. One of the first things I needed to do after installation? Add a new user with root access and a home directory.
There are actually three ways to do this: the right way, the wrong way, and the ugly way. Here’s how I did it (the smart way) and what I learned along the way.
🔧 The Right Way (Recommended)
- Create the user and automatically generate a home directory:
sudo adduser newuser -m
- Add the user to the sudo group to give them root privileges:
sudo usermod -aG sudo newuser
This is clean, safe, and easy to manage. It keeps all sudoers organized by group, and any user in the sudo
group has full administrative access.
💡 Bonus: One-liner Method
If you're into shortcuts, you can do it all in one command:
sudo useradd newuser -m -G sudo
Then, set a password:
sudo passwd newuser
😬 The Ugly Way
You can modify /etc/sudoers
to give specific users root privileges manually. Just add:
newuser ALL=(ALL:ALL) ALL
This works, but maintaining dozens of lines in your sudoers file for every admin gets messy fast.
☠️ The Wrong Way (Avoid!)
Don’t do this—but here’s how you could:
username:x:0:502::/home/username:/bin/bash
Setting a user’s UID to 0
essentially makes them root. It's unsafe, hard to track, and can destroy your system if misused. Trust me—don't go here.
✅ Recap
- Use
adduser -m
to create the user and their home directory. - Use
usermod -aG sudo
to grant root access cleanly. - Keep sudoers clean—group-based access is your friend.
Since doing this, I’ve used my home Ubuntu server to run n8n automations, TTS pipelines, MinIO S3 storage, and even FFmpeg video processing. With root access for my admin user, I can now manage everything directly—securely and efficiently.
If you're self-hosting anything, this is an essential skill. Hope it helps you out!