chmod 755, 644 and 777
How the Three Digits Map to Permissions
chmod 755 is a numeric way of writing a Linux permission setting, in which three octal (base 8) digits describe the owner, the group and others.
Each digit is the sum of three values: read is 4, write is 2 and execute is 1. A 7 therefore means read, write and execute (4 + 2 + 1), a 6 means read and write (4 + 2), a 5 means read and execute (4 + 1), and a 4 means read only. A 0 means no rights at all.
The digits are read from left to right as owner, group and others. The three-digit form covers the standard read, write and execute bits, which are described in the article on Linux file permissions.
What the Common Values Mean
755 gives the owner full rights (7) and gives the group and others read and execute rights (5 each). It is commonly used for directories and for programs everyone should be able to run. Others can enter the folder and read its contents but cannot change them.
644 gives the owner read and write (6) and the group and others read only (4 each). It is a common setting for ordinary files such as web pages and images, because the owner can edit them while everyone else can read them but not change them.
600 gives only the owner read and write, and nothing to anyone else. SSH private keys are normally kept this way, and SSH refuses to use a private key that other users can read.
Why 777 Is Discouraged
777 grants read, write and execute to the owner, the group and everyone else. Any account on the system, and any process running as any account, can then change or delete the file. On a shared server, that includes accounts belonging to other customers or to compromised services.
On a website, a writable file can be replaced with malicious code, and a world-writable folder lets anyone add files to the site. Such settings are a frequent source of security problems. A permission error is often better solved by fixing ownership or group membership, which is covered in the article on users and groups, than by opening access to everyone.
Frequently asked questions
What Is the Difference Between chmod 755 and chmod 644?
The main difference is the execute right. A 755 setting grants execute to the owner, group and others, which suits programs and directories that people need to enter. A 644 setting grants no execute right to anyone, which suits ordinary data files such as web pages, stylesheets and images.
Is chmod 777 Ever Acceptable?
It is rarely a good choice on a server. People sometimes use it briefly on a private, single-user machine while troubleshooting, but a narrower permission is safer on any shared or public system. If a file seems to need 777 to work, the cause is usually an ownership or group problem that should be fixed directly.