File permissions explained (644, 755 and why never 777)

What Linux file permissions mean, the correct values for website files and folders, and how to change them in DirectAdmin.

How-to guideIntermediate2 min readUpdated

Permissions decide who can read, write and execute a file.

Reading the numbers

Three digits: owner, group, everyone else. Each digit adds up:

ValuePermission
4Read
2Write
1Execute (for folders: enter)

So 7 = read + write + execute, 6 = read + write, 5 = read + execute, 4 = read.

Correct values for websites

ItemPermissionMeaning
Folders755You can change; others can enter and read
Files644You can change; others can read
Sensitive config (e.g. wp-config.php)640 or 600Tighter, if the site still works
Anything777Never

Why 777 is dangerous

It lets any process write to the file, making it easy for malicious code to modify or plant files. Hosting software designed for your account doesn’t need it. If a tutorial says to use 777, use 755 (folder) or 644 (file) instead.

Changing permissions

  1. In System Info & Files then File Manager, select the file or folder.
  2. Choose Permissions (or Set Permission).
  3. Enter the value, such as 644, and save.

Wrong permissions cause

Popular

Tip: press / to search from any pageSee all results