Understanding File & Directory Permissions (Firstserv Guide)

When files and directories are created on your hosting account, they are assigned permissions. These permissions control who can access, modify, or execute those files.

Firstserv hosting runs on Linux, which uses a structured permissions system based on three types of users.


Permission Types

Each file or directory has permissions assigned to three groups:

  • User (Owner): Your cPanel account
  • Group: Also associated with your account
  • Other: Everyone else (public access)

Each group can be given three types of permissions:

  • Read (r): View the contents of a file
  • Write (w): Modify or delete a file
  • Execute (x):
    • For files: run the file (e.g. scripts)
    • For directories: access/open the directory

How Permissions Are Represented

Permissions can be displayed in two formats:

Numeric (chmod)

Each permission has a numeric value:

  • Read = 4
  • Write = 2
  • Execute = 1

These values are added together for each user group.


Symbolic

Shown as letters:

-rw-r--r--
  • r = read
  • w = write
  • x = execute
  • - = no permission

Common Permission Examples

Files (644)

644 → -rw-r--r--
  • User: read + write (4+2 = 6)
  • Group: read (4)
  • Other: read (4)

✅ Standard for most files


Sensitive Files (600)

600 → -rw-------
  • Only the owner can read/write
  • No access for others

✅ Recommended for configuration files (e.g. wp-config.php)


Directories (755)

755 → drwxr-xr-x
  • User: full access (7)
  • Group: read + execute (5)
  • Other: read + execute (5)

✅ Standard for directories


How Permissions Work for Directories

Directory permissions behave slightly differently from files:

  • Read (r): Allows listing files in the directory
  • Execute (x): Allows entering/accessing the directory
  • Write (w): Allows creating/deleting files

Key Concept: Directory Traversal

To access a file, every directory in its path must allow execute (x) access.


Example Structure

public_html/
├── dir1 (755)
│   ├── file1.txt (644)
│   └── dir3 (700)
│       └── file3.txt (644)

Access Results

  • file1.txt → accessible

    • Directory (dir1) allows access
  • file3.txt → NOT accessible

    • Parent directory (dir3) blocks access

Why This Happens

Even if a file allows reading:

  • If any parent directory does not allow execute access,
  • The file cannot be reached

✅ Every folder in the path must allow "traversing" (x)


Another Example

dir1 (r-xr---)
└── dir3 (r-xr-xr-x)
    └── file3.txt (rw-r--r--)

❌ You still cannot access file3.txt

Reason:

  • dir1 blocks execute access for “Other”
  • You can’t reach dir3, even though it allows access

Best Practices

  • ✅ Use 644 for standard files
  • ✅ Use 600 for sensitive files
  • ✅ Use 755 for directories
  • ❌ Avoid 777 (full access for everyone)
  • ✅ Grant only the permissions required

Summary

  • Permissions control access to your files and directories
  • They are applied to:
    • User
    • Group
    • Others
  • Understanding how directory traversal works is essential for troubleshooting access issues

Correct permissions help keep your website both secure and functional.


If you’re unsure about your permissions or need help diagnosing access issues, the Firstserv support team is always available to assist.

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to disable LiteSpeed connection timeouts

LiteSpeed Timeouts Explained (Firstserv Guide) What is LiteSpeed? All Firstserv hosting...

What file and directory permissions should I use for my web files?

File & Directory Permissions (Firstserv Guide) Setting the correct file and directory...

Where should I upload my website files?

Where Should I Upload My Website Files? (Firstserv Guide) The Short Answer Your website...

How to clear your web browser cache

How to Clear Your Browser Cache (Firstserv Guide) Web browsers store cached data such as...

Using FileZilla to upload files via SFTP(SSH) or FTPS(SSL/TLS)

Setting Up FileZilla (Firstserv Guide) FileZilla is a free, open-source FTP client available...