AI Hints
Home›Linux Tutorial›Users and Permissions
Linux · Lesson 61 of 120

Users and Groups

Who can do what.

⏱ 2 min read▶ Video at 1:19:05🎓 Free
Watch this lesson in the Linux courseWatch on YouTube ↗Full Linux course

Linux was built from the start for many people sharing one computer. So it needs to know who's who, and who's allowed to do what. That's what users and groups are for.

Users and Groups
From the video: Users and Groups
  • Built for sharing
  • Who's who?
  • Users and groups

Users and groups

Every person who uses the computer gets a user account, with a name, a number, and a home folder. Programs often get their own users too, so they can't touch your files. A group is a collection of users. Give a group access to something, and everyone in it gets access.

Userone account per person
UIDthe user's number
Groupa set of users
Program userskeep services apart

Who am I, really

ID shows your user, and every group you belong to. Sam's user number is one thousand, and Sam is in a group called sam, plus a group called sudo. Groups prints just the group names. And W shows who's logged in right now.

Terminal
id
uid=1000(sam) gid=1000(sam) groups=1000(sam),27(sudo)
groups
sam sudo

A group of your own

Notice that Sam has a group with the same name. When Linux creates a user, it usually creates a matching group too, with just that user in it. That's why the long listing showed sam, sam. The owner was sam, and the group was also sam.

keyvalue
User samUID 1000
Group sammade automatically
ls -lshows owner and group
sudo groupmay run admin commands

Summary

Every person has a user account, and users belong to groups. ID and groups show yours. Next, where Linux stores the list of users.

Key takeaways
  • Users and groups
  • id
  • groups
Next up: The User List — /etc/passwd and /etc/group