Knowledgebase

Understanding File Permissions and Ownership Print

  • vpsservermanagement, permissions, restore, woocommerce, guide, howto, solution, zillionkinghost
  • 0

Who can read, write and execute what.

THE THREE SETS

Owner, group and others. Each has read, write and execute permissions.

Expressed numerically: read is 4, write is 2, execute is 1. Added together per set gives the familiar three-digit values.

THE COMMON VALUES

755 for directories: owner full, others read and enter 644 for files: owner read and write, others read 600 for files holding credentials: owner only 775 or 664 where a group needs write access

NEVER 777

It permits any process on the server to modify the file. If documentation tells you to use it, that documentation is wrong.

OWNERSHIP

Files should be owned by the user the application runs as. Wrong ownership after a restore or a copy is one of the most common causes of an application failing afterwards.

chown changes it, with -R to recurse.

SETTING THEM IN BULK

Use find to apply directory permissions and file permissions separately, rather than applying one value to everything.

CHECKING

ls -l shows permissions and ownership.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot