File Permissions
In Linux, every file and folder beongs to:
- Who can read it
- Who can modify it
- Who can run it
These rules help keep the system secure.
Every File Has an Owner
In linux, every file and folder belongs to:
- User (Owner) – The person who created the file
- Group – A collection of users
- Others – Everyone else on the system
Used this command to check:
ls -l
Example output:
-rw-r--r-- 1 kerviejay sysad 1200 Feb 15 notes.txt
Focus on this part:
kerviejay sysad
This means:
- keviejay = file owner
- learnlinux = group owner
Understanding Permission Symbols
I learn how to read this:
--rw-r--r--
It's divided into three parts:
rw- r-- r--
| | |
User Group Others
Each set has 3 letters:
| Letter | Meaning |
|---|---|
| r | Read |
| w | Write |
| x | Execute (run as program) |
| - | No permission |
So:
rw- - Owner can read and write
r-- - Group can only read
r-- - Others can only read
What chmod 755 Actually Means
Each permission has a number:
| Permission | Value |
|---|---|
| r | 4 |
| w | 2 |
| x | 1 |
Just add them.
Example:
7 = 4 + 2 + 1 = rwx
6 = 4 + 2 = rw-
5 = 4 + 1 = r-x
So when I run:
chmod 755 script.sh
It means:
- Owner - 7 → rwx
- Group - 5 → r-x
- Others - 5 → r-x
Changing Permissions
- Using Numbers
chmod 644 file.txt
chmod 755 script.sh
chmod 600 private.txt
Common examples:
644 - Normal file
755 - Executable scrip
600 - Private file (like SSH keys)
- Using Letters
chmod u+x script.sh
This means:
u - user
+x - add execute permission
Other options:
g - group
o - others
a - all
Example:
chmod a+r file.txt
Means: Adds read permission for everyone.
Changing File Owner
Sometimes you need to change who owns a file.
sudo chown newuser file.txt
Change owner and group:
sudo chown newuser:newgroup file.txt
Change group only:
sudo chown :newgroup file.txt
or
sudo chgrp newgroup file.txt
Today’s lesson helped me move from memorizing commands to actually understanding how Linux permissions work. I learned how Linux file permissions and ownership work, including the difference between user, group, and others. I now understand how to read permission symbols like rwx and how numbers like 755 and 644 are calculated using chmod.
Tomorrow, I will be moving on to Archiving and Compressing files as Part 14 of my learning journey.
Top comments (0)