Skip to content

User Management – The Way of the Root

Welcome, warrior! Every Linux system has multiple users, but only one holds ultimate power—the root user. Root can do anything… but with great power comes great responsibility (and a high chance of breaking things).

Today, we learn to create, manage, and delete users like a true Linux master.

Who Am I? (Identity Crisis)

Before we start, let’s confirm who we are:

bash
whoami  # Am I a normal user or the all-powerful root?

If you see root, be careful! You wield dangerous power. ⚠️ If not, you can become root with:

bash
sudo su -

Now, let’s manage some users!

Creating New Users – Welcome to the Dojo

To add a new warrior (user) to the system, use:

bash
sudo adduser noobninja

It will ask for a password (set something secret).

Want to skip the prompts?

bash
sudo useradd -m -s /bin/bash noobninja
sudo passwd noobninja  # Set a password

Now, "noobninja" is part of your Linux dojo. 🎉

Switching Users – Be Like a Chameleon

Want to become another user? Use:

bash
su - noobninja

This logs you in as noobninja. Want to go back? Just type:

bash
exit

Boom! You're back to your original self.

Giving a User Superpowers (Sudo Access)

By default, normal users are mere mortals. To grant them sudo powers (admin rights), add them to the sudo group:

bash
sudo usermod -aG sudo noobninja

Now, "noobninja" can use sudo to execute commands as root.

Deleting Users – Banishment!

To remove a user:

bash
sudo deluser noobninja

To delete a user and their home directory (wipe them from existence):

bash
sudo deluser --remove-home noobninja

Be careful! There's no undo button.

Checking Users on the System

Want to see all users?

bash
cat /etc/passwd

Too much info? Just filter usernames:

bash
cut -d: -f1 /etc/passwd

To see who’s currently logged in:

bash
who

Or for a detailed view:

bash
w

Locking & Unlocking Users

Sometimes, you need to lock a user out (like when your little brother messes with your system):

bash
sudo passwd -l noobninja

To unlock them later:

bash
sudo passwd -u noobninja

Your Training Task

Try creating a new user, switching to them, and giving them sudo powers. Then, delete them (if you dare).

bash
sudo adduser hacker
sudo usermod -aG sudo hacker
su - hacker

If everything works, congrats! You’ve mastered the Way of the Root! 🥋🐧

Up next: The Art of File Permissions! 🔥🔒

Built by noobs, for noobs, with love 💻❤️