How to Set Correct File Permissions on Your Server

File permissions control who can read, write, and execute files on your server. Setting them correctly is an important part of hosting security - overly permissive settings can allow attackers to modify or execute your files.

Understanding Permission Numbers

Permissions are expressed as three-digit numbers. Each digit represents permissions for the owner, group, and public respectively. The values are:

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

For example, 644 means the owner can read and write, while everyone else can only read.

Recommended Permissions

  • Files: 644 - readable by everyone, writable only by the owner.
  • Directories: 755 - readable and navigable by everyone, writable only by the owner.
  • wp-config.php (WordPress): 600 - readable and writable only by the owner; no one else can access it.
  • Executable scripts: 755 - allow execution by the owner and others.

How to Change Permissions in cPanel

  1. Log in to cPanel and open File Manager.
  2. Navigate to the file or folder you want to change.
  3. Right-click the file and select Change Permissions.
  4. Set the desired permission value and click Change Permissions.

Bulk Permission Changes via SSH

If you have SSH access, use these commands to fix permissions across your entire site:

  • Files: find /home/user/public_html -type f -exec chmod 644 {} \;
  • Directories: find /home/user/public_html -type d -exec chmod 755 {} \;

Questions about file permissions? Contact our support team.

100% Satisfaction Guarantee

We're so confident you'll love dotCanada that we offer a 30-day money-back guarantee. Not satisfied? Get a full refund, no questions asked.

Ready to Get Started?

Join thousands of Canadian website owners who trust dotCanada for reliable, fast web hosting.

Get Started Today