Advertisement
linuxserver Linux file permissions control who can read, edit, or run files on your server. If you're new to Linux, this guide explains permissions in the simplest possible way using practical examples. You’ll learn how chmod, chown, and permission numbers work — all explained step-by-step with a friendly tone so even complete beginners can understand. Perfect for Linux server admins, web developers, and anyone managing files on a VPS.

Understanding Linux File Permissions (chmod & chown) for Total Beginners

5 Min Read Verified Content

Welcome back, young explorer!
Today we’re going to unpack something that confuses almost every Linux beginner:


👉 File permissions and ownership
Or in Linux language:

  • chmod

  • chown

  • rwx

  • 755, 644, etc.

Don’t worry — we’re going to break this down until it feels natural and easy.
Think of this as learning how locks and keys work in your digital house.

Let’s begin.




🧩 Step 1: What Are File Permissions?

In Linux, every file has rules controlling:

1. Who can read it

2. Who can modify it

3. Who can run it

These are known as permissions, represented by:

r = read w = write x = execute

And they apply to three groups:

user (owner of the file) group (members of the file’s group) others (everyone else)

Let’s see an example.

Run:

ls -l

You might see something like:

-rw-r--r-- 1 root root 4096 Jan 10 index.html

Breakdown:

SectionMeaning
-rw-r--r--Permissions
rootUser (owner)
rootGroup
index.htmlFile name

Let’s decode the permission part:

-rw-r--r-- ^ ^ ^ ^ | | | | type | | others | group user

This means:

  • user: read + write

  • group: read

  • others: read

Simple so far, right?




🛠️ Step 2: Changing Permissions with chmod

chmod means change mode — the tool used to change file permissions.

There are two methods:

  • Letter (r, w, x)

  • Number (755, 644)

Let’s start with the beginner-friendly number system.




🔢 Step 3: Understanding Permission Numbers (chmod)

Each permission has a number:

PermissionValue
read (r)4
write (w)2
execute (x)1

To assign permissions, you add up the values.

Example:

Read + Write:

4 + 2 = 6

→ permission = 6

Read Only:

4 = 4

→ permission = 4

Read + Execute:

4 + 1 = 5

→ permission = 5

Full Permissions:

4 + 2 + 1 = 7

→ permission = 7

So when you see:

chmod 755 file

Break it down:

  • user: 7 → rwx

  • group: 5 → r-x

  • others: 5 → r-x

This is very common for web apps.




🧪 Step 4: Common chmod Values You Will Use Daily


ValueMeaningUse case
755user: rwx / group: r-x / others: r-xweb directories, scripts
644user: rw- / group: r-- / others: r--HTML, config files
600user: rw- onlySSH keys
700user: rwx onlyprivate scripts or folders
777everyone can do everything❌ avoid! dangerous!


Setting 755 on a folder:

chmod 755 /var/www/myapp

Setting 644 on a file:

chmod 644 /var/www/myapp/index.html

Setting 600 on private key:

chmod 600 ~/.ssh/id_rsa


👑 Step 5: Changing Ownership with chown

chown means change owner of a file.

Format:

chown user:group filename

Example: assigning ownership to user www-data:

sudo chown www-data:www-data /var/www/myapp -R

-R = recursively (apply to all files inside)


When do you use chown?

✔ When installing web apps
✔ When uploading files via FTP
✔ When fixing "Permission denied" errors
✔ When Apache/Nginx cannot read a file




⚠️ Step 6: Fixing Common Permission Problems


❌ Error: Permission denied

Cause: You don’t have permission.
Fix: Allow read/write:

chmod 644 filename

Or change owner:

sudo chown youruser:youruser filename


❌ Nginx/Apache cannot access your site

Give correct web user permissions:

Ubuntu/Debian uses:

sudo chown -R www-data:www-data /var/www/html

CentOS/RHEL uses:

sudo chown -R nginx:nginx /usr/share/nginx/html


❌ SSH key not working


Your permissions are too open.

Fix:

chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys chmod 600 ~/.ssh/id_rsa


🎯 Step 7: What Permissions Should You Never Use?


❌ Never use chmod 777

This gives EVERYONE full control.

Hackers LOVE 777.
Don’t give it to them.

❌ Never give write access to “others”

Example:

-wx-wx-wx

This is a recipe for disaster.

Stick to safe numbers:

  • 644 for files

  • 755 for folders

  • 600 for private files



🔐 Bonus: Permission Cheat Sheet (Copy & Save!)

chmod 755 folder/ # Allow read+execute for everyone, write only for owner chmod 644 file.txt # Normal file permissions chmod 600 id_rsa # Private SSH key chown user:user file.txt # Change file ownership chown -R www-data:www-data /var/www # Fix web server ownership


🎉 Conclusion

You just learned:

✔ How Linux permissions work
✔ How to understand rwx
✔ How chmod numbers like 755 and 644 work
✔ How to change ownership with chown
✔ How to fix common permission errors
✔ What to avoid (like 777!)


File permissions are fundamental.
After reading this guide, you are now far more comfortable managing secure Linux servers.


Advertisement
Back to Linuxserver