Published on

What is Linux? - Part 3: Users & Groups

Authors

Alright, tech enthusiasts, imagine this scenario for a moment: You're hosting a wild party in your house, the House of Linux let's call it. Now, wouldn't it be absolute chaos if everyone had access to every room in your house? The audacity! Uncle Gary going through your sock drawer and cousin Phuong rearranging your pantry. Preposterous! What you need is a way to control who can go where and do what. And that's where our next episode in the What is Linux? series comes in: Welcome to the bustling world of Users and Groups!

In our lovely House of Linux, each guest, or user, has their account with specific permissions. Linux identifies each user with a unique user ID (UID), like a special secret handshake. We can even categorize users into groups, like putting all the fun-loving party animals into one group and the quiet bookworms into another. Each group gets a unique group ID (GID). Now, ain't that handy?

We can check who's partying in our house (i.e., logged into our system) with the who command:

who

This command will give us a list of users currently logged into the system. Looks like Uncle Gary managed to sneak in again!

who.png

Let's create a new guest (user) with the useradd command. We'll call this user 'gandalf':

sudo useradd gandalf

Great! Now Gandalf is ready to party, but he's a pretty powerful wizard, so we don't want him running around unrestricted. Let's put Gandalf in a group, 'wizards', using the groupadd command:

sudo groupadd wizards
sudo usermod -aG wizards gandalf

There we go! Now Gandalf is a member of the 'wizards' group. We can check Gandalf's groups using the groups command:

groups gandalf

Perfect! Our party is organized, our guests are sorted, and the House of Linux is a haven of peace and tranquility. With Users & Groups, we can control who can access what files, directories, and resources, keeping Uncle Gary away from our sock drawer and ensuring a smooth, peaceful party!

Join us next time when we explore the grand hallways and rooms of our House of Linux in the exciting episode: Directories and Files. Until then, party responsibly in your Linux houses, folks!