
Linux Users, Groups, and Permissions Explained

Linux is an operating system like Windows or macOS, but it is open‑source and follows Unix design principles. One of its core strengths is how it handles multiple users securely on the same machine.
Understanding users, groups, and permissions helps you control who can do what on a system and prevents accidental or unauthorized access. Let’s understand these concepts with a practical example.
Example scenario
Assume you have an Ubuntu server where your software is deployed, and a team of four members working on it.
1// Acme Team23- Alice (developer)4- Jimmy (developer)5- John (deployment)6- Nami (deployment)
Users
- When Linux is installed, it creates a default user called
root. - The
rootuser has unrestricted privileges on the system. - Every user in Linux is assigned a User ID (UID).
1# Typical UID ranges:23(0) → root user (superuser)4(1 – 999) → system / service users (docker, redis, postgres, etc.)5(1000+) → normal users (alice, john, etc.)
Creating users
Let’s onboard our team to the server.
1# create a user and home directory2sudo useradd -m alice34# set password for the user5sudo passwd alice
Groups
- Groups exist so that we don’t manage permissions user‑by‑user.
- A file or directory can belong to one group, but many users can belong to that group.
Creating groups and assigning users
1# create groups2sudo groupadd developers3sudo groupadd deployment45# add users to groups6sudo usermod -aG developers alice7sudo usermod -aG developers jimmy89sudo usermod -aG deployment john10sudo usermod -aG deployment nami
Permissions
Assume we have a project directory with the following files:
1project/2├── index.html3├── style.css4└── deploy.sh
Access rules
- Developers should be able to read and write project files.
- Deployment team should be able to execute the deployment script.
Permission basics
In Linux, every file and directory has three permissions:
- read (r)
- write (w)
- execute (x)
Each file or directory:
- Belongs to one user (owner)
- Belongs to one group
- Has permissions defined for:
- owner
- group
- others
Viewing permissions
1ls -l project23# Example output:4-rw-r--r-- 1 root root 29 Feb 5 12:45 deploy.sh5-rw-r--r-- 1 root root 5950 Feb 5 12:44 index.html6-rw-r--r-- 1 root root 8887 Feb 5 12:45 style.css
Understanding ls -l output
1[1] [2] [3] [4] [5] [6] [7]2- rw-r--r-- 1 root root 29 Feb 5 12:45 deploy.sh
[1] File type
-→ regular filed→ directory
[2] Permissions
1rw- r-- r--2│ │ │3│ │ └─ others4│ └─ group5└─ owner
r→ readw→ writex→ execute-→ permission not granted
Meaning here:
- Owner → read, write
- Group → read only
- Others → read only
Other fields:
- [3] Hard link count
- [4] Owner user (
root) - [5] Owner group (
root) - [6] File size (bytes)
- [7] File name
Changing ownership → chown
chown is used to change the owner and group of a file or directory.
1# -R applies changes recursively2sudo chown -R root:developers project
Change ownership of only the deployment script:
1sudo chown root:deployment project/deploy.sh
Changing permissions → chmod
chmod controls what actions are allowed on a file or directory.
Symbolic mode
1# u = user, g = group, o = others2chmod -R u=rw,g=r,o=r project
- user → read, write
- group → read
- others → read
Numeric (octal) mode
Permissions map to numbers:
r→ 4w→ 2x→ 1
Example:
- user →
rwx→ 7 - group →
rw-→ 6 - others →
---→ 0
1chmod 760 deploy.sh
Linux permissions are evaluated in this order:
owner → group → others
