- 1View File Permissions in Linux
- 2Change File Permissions with chmod in Linux
- 3How to Use Numeric Mode with chmod in Linux
- 4chmod Symbolic Mode in Linux
- 5How to Change File Ownership in Linux
- 6How to Change Group Ownership Using chgrp in Linux
- 7Understanding Linux File Permission Symbols (r, w, x)
- 8Linux File Permissions - User, Group, Others
- 9Understanding Special Permissions in Linux: SUID, SGID, and Sticky Bit
- 10How to Use ACLs in Linux - Set File Permissions
- 11Set ACL Permissions in Linux with setfacl
- 12How to View ACLs using getfacl in Linux
- 13Find Files by Permissions in Linux
How to Use Symbolic Mode with chmod
How to Use Symbolic Mode with chmod
Welcome to this beginner-friendly Linux tutorial! Today, we’re learning how to change file permissions using symbolic mode with the chmod
command.
Don't worry if you've never used chmod
before. We’ll go step-by-step and use real examples so that it’s easy to follow.
🔍 What is chmod
?
The chmod
command is used to change the permissions of files and directories in Linux. Permissions decide who can read, write, or execute a file.
📘 Understanding Symbolic Mode
In symbolic mode, we use letters and symbols to describe permissions:
- u = user (owner)
- g = group
- o = others
- a = all (u+g+o)
Then we use operators:
- + = add permission
- - = remove permission
- = = set exact permission
- r = read
- w = write
- x = execute
🛠️ Let's Practice!
Step 1: Create a sample file
touch demo.txt
Step 2: Check the current permissions
ls -l demo.txt
-rw-r--r-- 1 user user 0 Jul 2 10:00 demo.txt
This means the owner can read and write, and group/others can only read.
🔧 Add execute permission for the user
chmod u+x demo.txt
Check again:
ls -l demo.txt
-rwxr--r-- 1 user user 0 Jul 2 10:00 demo.txt
Now the user has execute permission too.
➖ Remove read permission from others
chmod o-r demo.txt
ls -l demo.txt
-rwxr----- 1 user user 0 Jul 2 10:00 demo.txt
Others can no longer read the file.
🔄 Set group permissions to exactly read and execute
chmod g=rx demo.txt
ls -l demo.txt
-rwxr-x--- 1 user user 0 Jul 2 10:00 demo.txt
The group now has only read and execute permissions.
📌 Tip: Use a
to affect all
chmod a-w demo.txt
ls -l demo.txt
-r-xr-xr-- 1 user user 0 Jul 2 10:00 demo.txt
This removes write permission from everyone.
🎉 Recap
chmod
in symbolic mode is readable and intuitive- Use
u
,g
,o
,a
to choose who you're modifying - Use
+
,-
,=
to set permissions - Use
r
,w
,x
to define permission types
Practice with different combinations and try it out on both files and directories!
That’s it for this tutorial! 🚀
Next Topic ⮕How to Change File Ownership in Linux
Comments
Loading comments...