Linux File Permissions 755 644 on a Web Server

1. What Are File Permissions?

File permissions are a security system that controls who can read, write, or execute files and directories on a Linux server — the same OS that powers all web hosting and VPS environments at AsiaGB.

Linux splits users into three categories:

And three types of access:

💡 Key Point

The web server process (Apache/Nginx) must be able to read your web files. Wrong permissions cause immediate 403 Forbidden errors for your visitors.

2. The Octal System: Reading Permission Numbers

Linux represents permissions as a 3-digit octal (base-8) number. Each digit is the sum of Read (4) + Write (2) + Execute (1) for Owner, Group, and Others respectively.

# How to read permission numbers Permission: 7 5 5 │ │ └── Others: 4+1 = r-x (read + execute, no write) │ └───── Group: 4+1 = r-x (read + execute, no write) └──────── Owner: 4+2+1 = rwx (full access) Permission: 6 4 4 │ │ └── Others: 4 = r-- (read only) │ └───── Group: 4 = r-- (read only) └──────── Owner: 4+2 = rw- (read + write)

When you run ls -la in a terminal, you see these as letters like drwxr-xr-x — d for directory, then three groups of rwx for Owner/Group/Others.

3. Permission 755 — What It Means & When to Use It

755 translates to rwxr-xr-x:

When to use 755

âš ī¸ Warning

If a directory is set to 700, the web server cannot enter it at all — your entire site will show 403 Forbidden.

4. Permission 644 — What It Means & When to Use It

644 translates to rw-r--r--:

When to use 644

644 works because the web server (running as group or others) can still read the file to serve it, but cannot modify it — significantly more secure than 777.

5. Permission Comparison Table

PermissionSymbolOwnerGroupOthersUse Case
644rw-r--r--Read+WriteReadReadRegular web files
755rwxr-xr-xFullRead+ExecRead+ExecDirectories
600rw-------Read+WriteNoneNonewp-config.php, SSH keys
700rwx------FullNoneNonePrivate directories
777rwxrwxrwxFullFullFull❌ Never use on web files!

6. Setting Permissions in DirectAdmin

AsiaGB Hosting uses DirectAdmin, which has a built-in File Manager — no terminal needed.

Step-by-step

  1. Log in to your DirectAdmin control panel (e.g., yourdomain.com:2222)
  2. Click Files → File Manager
  3. Navigate to the file or folder you want to change
  4. Right-click → select Change Permissions
  5. Enter the numeric permission value (e.g., 755 or 644) and click OK
💡 Tip

To change multiple files at once, hold Ctrl and click each file, then right-click → Change Permissions to apply in bulk.

7. chmod Commands on VPS

If you have SSH access to an AsiaGB VPS, the chmod command gives you precise control.

Basic commands

# Change a single file chmod 644 index.php chmod 755 public_html # Recursive change (everything inside a directory) chmod -R 755 wp-content/ chmod -R 644 wp-content/uploads/ # View current permissions ls -la ls -la wp-content/

The right way: set files and directories separately

The safest approach for WordPress is to use find to set directory and file permissions independently in one pass:

# Navigate to your WordPress root cd /home/username/public_html # Set all directories to 755 find . -type d -exec chmod 755 {} \; # Set all files to 644 find . -type f -exec chmod 644 {} \; # Protect wp-config.php chmod 600 wp-config.php
💡 Why use find instead of chmod -R?

chmod -R applies the same value to both files and directories. Using find -type d and find -type f separately ensures directories get 755 while files get 644 — the correct combination.

8. Common Errors from Wrong Permissions

403 Forbidden

The most common symptom of permission errors. The web server can't read your files.

ProblemWrong PermissionFix To
403 on entire sitepublic_html = 700755
403 on index pageindex.php = 600644
403 on imagesuploads/ = 700755
PHP write erroruploads/ = 555755

Hacked Site / Shell Upload

The #1 root cause is directories or upload folders set to 777. Attackers upload a PHP web shell through a file upload form and gain full control of your server.

🚨 Critical Security Warning

Never set any web-accessible file or directory to 777. The uploads/ directory is the most common attack vector — an attacker can upload a PHP shell and execute arbitrary commands on your server the moment it goes 777.

9. WordPress Security Permissions

Here is the complete recommended permission setup for a WordPress site:

File / DirectoryRecommendedReason
public_html/755Web server must access
All PHP files644Readable, not writable by server
wp-config.php600Contains DB password — max security
wp-content/755WordPress must write plugins/themes
wp-content/uploads/755Allow uploads but not 777
.htaccess644Apache reads it; no one else writes

Summary

  • 755 — for all directories; lets the web server enter them
  • 644 — for all regular files; web server can read, nobody writes except owner
  • 600 — for sensitive config files like wp-config.php
  • 777 — never use on web files; it opens a shell-upload backdoor
  • Use find -type d and find -type f separately to apply the correct permissions in one shot
  • DirectAdmin File Manager lets you change permissions visually without SSH

Frequently Asked Questions

Is permission 777 dangerous?

Extremely dangerous. It grants full read/write/execute to everyone on the server. Attackers exploit this to upload PHP shells and run arbitrary commands. Never use it on any web-accessible location.

What permissions should WordPress files use?

Set all directories to 755 and all files to 644. Set wp-config.php to 600 since it holds your database credentials.

Why am I getting a 403 Forbidden error?

Your directory is likely set to 700 (blocking the web server) or your index file is 600. Fix: set directories to 755 and files to 644.

Can I change permissions in DirectAdmin without SSH?

Yes. In DirectAdmin → Files → File Manager, right-click any file or folder → Change Permissions → enter the numeric value and click OK.

What is the difference between 644 and 640?

644 lets others (including the web server process) read the file. 640 denies all access to others. Use 644 for regular web files and 600 for sensitive config files.

How do I set permissions for all files and directories at once?

Use: find . -type d -exec chmod 755 {} \; for directories and find . -type f -exec chmod 644 {} \; for files. This correctly applies different values to each type, unlike chmod -R which uses the same value for both.