Mastering Linux File Permissions and Ownership: A Comprehensive Guide
Learn how to read and modify Linux file permissions using chmod, chown, and ls -l. Understand octal values and file ownership basics.
Mastering Linux File Permissions and Ownership: A Comprehensive Guide
Learn how to read and modify Linux file permissions using chmod, chown, and ls -l. Understand octal values and file ownership basics.

Mastering Linux File Permissions and Ownership
Learn how to control access to your files and directories like a Linux pro using **chmod, chown**, and more.
Understanding Linux File Types
When you run **ls -l**The very first character in each line tells you what type of file you’re dealing with:
**-** → Regular file**d** → Directory**c**→ Character device**b** → Block device**l** → Symbolic link**s** → Socket**p**→ Named pipe (FIFO)
📝 Example:
$ ls -l
-rwxr--r-- 1 bob users 1234 Apr 24 10:00 bash-script.sh
- Here,
**-** means it's a regular file.

Understanding File Permissions in Linux
Each file or directory has 3 types of permissions for 3 user categories:
- User (u): Owner of the file
- Group (g): Group assigned to the file
- Others (o): Everyone else
Each category has 3 permission types:
**r** (Read) → 4**w** (Write) → 2**x** (Execute) → 1
💡 The permission string **-rwxr-xr--** breaks down like this:
- Owner:
**rwx**(7) - Group:
**r-x** (5) - Others:
**r--** (4)
🧮 Octal representation: **chmod 754 filename**

Permissions and Directories
Permissions apply to directories too:
**r**: List contents of the directory**w**: Create or delete files in the directory**x**: Enter (cd into) the directory
👀 Example: Bob owns a directory with only **--x------**:
- He can enter it (
**cd) but not list (`ls`**) the contents.

⚠️ Important: Linux applies permission hierarchically:
- First, checks if you’re the owner
- Then the group
- Finally others
Numeric vs Symbolic Permission Modes
📊 Numeric Mode
- Provide full access to Owners, group and others
[~]$ chmod 777 test-file
- Provide Read and execute access to Owners,groups and others
[~]$ chmod 777 test-file
- Read and write access for Owner and Group, no access for others.
[~]$ chmod 660 test-file
- Full access for Owner, read and execute for group, and no access for others.
[~]$ chmod 750 test-file

🎯 Each digit is the sum of permission bits:
**7= `rwx`** = 4+2+1**5=r-x** = 4+0+1**0= `---`** = 0
Symbolic Mode
- Provide full access to owners
[~]$ chmod u+rwx test-file
- Provide Read access to Owners, groups, and others, remove execute access
[~]$ chmod ugo+r-x test-file
- Remove all access for others
[~]$ chmod o-rwx test-file
- Full access for Owner, add read, remove execute for group, and no access for others
[~]$ chmod u+rwx,g+r-x,o-rwx test-file

Changing Ownership and Groups
Use the **chown and `chgrp` **commands to reassign file ownership.
- Changes owner to Bob and group to developer
[~]$ chown bob:developer test-file
- Change just the owner of the file to Bob. Group unchanged.
[~]$ chown bob andoid.apk
- Change the group for the test file to the group called Android.
[~]$ chgrp android test-file

📝 These commands require root privileges or **sudo**.
Examples to Practice
Example 1: Give Execute Permission to All
chmod +x install.sh
Example 2: Set 755 Permission
chmod 755 start.sh
Example 3: Change Ownership to Alice
chown alice:admins deploy.sh
Try It Yourself
Jump into a terminal and try these exercises:
- Create a file and restrict access using
chmod 600 - Make it executable for everyone using
chmod 755 - Change ownership to another user with
chown
👉 These hands-on tasks are essential for real-world Linux sysadmin skills.
Final Thoughts
Understanding and managing Linux file permissions is essential for both system security and proper file sharing. With commands like **chmod, `chown**, and**ls -l`**You can take full control of who gets access to what on your system.
Claps and comments, and following the codingsprint channel are appreciated 💬👏 Let’s keep learning together and growing as Linux pros.
🔗 Connect with us: 📘 Facebook | 🐦 Twitter | 💻 GitHub | 🔗 LinkedIn
Thank you for being a part of the community
Before you go:
- Be sure to clap and follow the writer ️👏️️
- Follow us: **X | [LinkedIn](https://www.linkedin.com/company/inplainenglish/) | [YouTube](https://www.youtube.com/@InPlainEnglish) | [Newsletter](https://newsletter.plainenglish.io/) | [Podcast](https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0) | [Differ](https://differ.blog/inplainenglish) | [Twitch](https://twitch.tv/inplainenglish)**
- **Check out CoFeed, the smart way to stay up-to-date with the latest in tech 🧪**
- **Start your own free AI-powered blog on Differ** 🚀
- **Join our content creators community on Discord** 🧑🏻💻
- For more content, visit **plainenglish.io + [stackademic.com](https://stackademic.com/)**
메타데이터
- post_id
- 5ee7c4e59e9a
- slug
- mastering-linux-file-permissions-and-ownership-a-comprehensive-guide-5ee7c4e59e9a
- url
- https://blog.stackademic.com/mastering-linux-file-permissions-and-ownership-a-comprehensive-guide-5ee7c4e59e9a
- canonical_url
- https://blog.stackademic.com/mastering-linux-file-permissions-and-ownership-a-comprehensive-guide-5ee7c4e59e9a
- author_url
- https://medium.com/@codingsprints
- status
- ok
- fetched_at
- 2026-06-26 03:39:16