Linux User Management & File Permissions
Create users, manage groups, assign sudo access, and master chmod.
Linux User Management & File Permissions
Create users, manage groups, assign sudo access, and master chmod.

Linux user management & file permissions
Linux is a multi-user operating system. Every file has an owner and a set of permissions that control who can read, write, or execute it. Understanding users, groups, and permissions is essential for securing your servers and managing teams on shared infrastructure.
1. Two Core Concepts
Authentication — verifying who you are. Managed by creating a user and setting a password.
Authorization — what you’re allowed to do. Managed by adding users to groups and editing the sudoers file.
root is the superuser with full access to everything. Normal users like ec2-user have limited permissions and must use sudo for admin actions.
2. User Commands
useradd username: Create a new user
passwd username: Set or change a user’s password
userdel username: Delete a user account
su — username: Switch to another user account
sudo -i: Switch to root user
cat /etc/passwd: List all users on the system
who or w: Show who is currently logged in
last: Show recent login history for all users
Example — Create a new user and set a password:
useradd john
passwd john
cat /etc/passwd # verify user was created
3. Granting sudo Access (visudo)
By default, new users cannot run admin commands. To grant sudo access, you edit the sudoers file using visudo:
Step 1 — Open the sudoers file:
visudo
Step 2 — Navigate to the root line (around line 100) and add your user below it:
root ALL=(ALL) ALL
john ALL=(ALL) ALL
Step 3 — Save with :wq, then verify:
su - john
sudo useradd pushpa # this should now work
Never edit /etc/sudoers directly. Always use visudo — it validates syntax before saving, protecting you from locking yourself out.
4. Group Commands
Groups let you manage permissions for multiple users at once. Add a user to a group to give them collective access to shared resources.
groupadd groupname: Create a new group
usermod -aG groupname username: Add a user to a group
cat /etc/group: List all groups on the system
Example — Create a ‘devops’ group and add a user to it:
groupadd devops
usermod -aG devops john
cat /etc/group # verify john is in devops group
5. Understanding File Permissions
Every file has three permission sets — for the Owner (User), the Group, and Others (World). Each set has three permission bits: r (read), w (write), x (execute).
Reading a permission string:
-rw-r--r-- 1 root root 0 Dec 22 07:59 test.txt
^^^
||| → Owner: rw- = can read and write (no execute)
^^^ → Group: r-- = can read only
^^^ → Others: r-- = can read only
Permission values: r = 4, w = 2, x = 1. Add them to get the octal number.
6. chmod — Changing Permissions
chmod 777 filename
rwx rwx rwx — Full access for everyone
chmod 775 filename
rwx rwx r-x — Owner/Group full, Others read+execute
chmod 755 filename
rwx r-x r-x — Owner full, Group/Others read+execute
chmod 664 filename
rw- rw- r — — Owner/Group read+write, Others read only
chmod 644 filename
rw- r — r — — Owner read+write, Others read only
chmod 400 filename
r — — — — — — Owner read only (very restrictive)
chmod 600 is common for SSH private key files (.pem). It means only the owner can read/write — no one else has any access.
Next up → Part 5: Linux DevOps Commands — environment variables, Git, compression, and the commands you’ll use every day in CI/CD pipelines.
메타데이터
- post_id
- f725d7e9d4e7
- slug
- linux-user-management-file-permissions-f725d7e9d4e7
- url
- https://medium.com/@dipaligunjal1145/linux-user-management-file-permissions-f725d7e9d4e7
- canonical_url
- https://medium.com/@dipaligunjal1145/linux-user-management-file-permissions-f725d7e9d4e7
- author_url
- https://medium.com/@dipaligunjal1145
- status
- ok
- fetched_at
- 2026-07-13 06:23:13