Sooner or later a setup guide or deployment checklist tells you to set something to 755, and just as often another source warns you never to use 777, without either explaining the number. The three digits look arbitrary, but they are a small piece of arithmetic. Once you see how each digit is built you can read any mode at sight and work out the right one for a file nobody has written a guide about.
This guide decodes 755 digit by digit using the free Chmod Calculator on Ovatly, which converts between the ticked permission boxes, the octal mode and the symbolic string in both directions. It covers when 755 is the right choice, and when 644 or 600 should take its place.
Contents
- Quick answer
- Three digits, three audiences
- The arithmetic: 4, 2 and 1
- Reading 755 in symbolic form
- How to build and check a mode, step by step
- Worked example: 644, the standard web file mode
- When to use 755, and when not to
- Common mistakes
- FAQs
- Conclusion
Quick answer
755 is a Unix permission mode in three digits, one each for owner, group and everyone else. Each digit adds up what that audience may do: read is 4, write is 2, execute is 1. So the owner digit 7 means read, write and execute; the group and others digits 5 mean read and execute. The result, symbolic form rwxr-xr-x, is the classic setting for directories and executable scripts: the owner has full control, and everyone else can look and run but not modify. To check any mode both ways, open the Chmod Calculator, tick the boxes to build a number, or type a number to see its boxes.
Three digits, three audiences
Unix permissions answer one question: who is allowed to do what to this file? The "who" is split into three audiences, and the mode gives each of them one digit, always in the same order.
The first digit is the owner, usually the user who created the file. The second is the group, a named set of users who share an interest in the file, such as a team or the web server's group. The third is others: every remaining user on the system. Read a mode like 755 left to right in that order: the owner gets the most generous digit, and others, the audience you know least, the most restricted one.
The arithmetic: 4, 2 and 1
Each audience can be granted up to three permissions, each with a fixed value. Read is worth 4: contents can be opened and viewed, or a directory's listing seen. Write is worth 2: contents can be changed, or files created and deleted inside a directory. Execute is worth 1: a file can be run as a program, or a directory entered.
A digit is just the sum of the permissions granted. Grant all three and you get 4 + 2 + 1 = 7. Grant read and execute, 4 + 1 = 5. Grant read alone, 4; nothing, 0. That is the whole system: every mode from 000 to 777 is three of these small sums in a row, and 755 is 7 for the owner and 5 for each of the other two audiences.
Reading 755 in symbolic form
The same permissions also appear as a nine-character symbolic string, the one ls -l shows and the calculator displays beside the number. Each audience gets three characters, in read, write, execute order, with a dash where a permission is absent. For 755 the owner row is rwx, all three present; the group and others rows are r-x, read and execute with write denied. Joined together: rwxr-xr-x.
The calculator's own example shows the contrast with a plain file: owner read and write, group and others read-only gives 644, symbolic rw-r--r--. Compare the two strings and the difference between a file people read and a thing people run is exactly the x characters.
How to build and check a mode, step by step
- Open the Chmod Calculator. You will see permission checkboxes arranged by audience: owner, group and others, each with read, write and execute.
- To build a mode, tick the boxes for the permissions you intend. For 755 that is all three boxes for the owner, and read plus execute for the group and for others.
- Read the results: the octal value, the symbolic form, and the ready-to-use chmod command you can paste into a terminal.
- To check a mode you have been told to use, go the other way: type the octal mode, such as 644, into the lower field and press Apply octal. The checkboxes load to show exactly which permissions that number represents, which ends the classic "is this number right?" guesswork before you apply anything to a real file.
Worked example: 644, the standard web file mode
The calculator's worked example is the mode you will meet most often on a web server. Start from the requirement in words: the owner should be able to edit the file, and nobody else should be able to change it, though the web server and visitors need to read it.
Owner first: read plus write is 4 + 2 = 6, no execute, because a stylesheet or page of markup is not a program. Group: read only, 4. Others: read only, 4. The mode is 644, symbolic rw-r--r--. Place it next to 755 and the pairing the calculator's notes describe becomes obvious: directories sit one step higher than the files inside them, 755 and 644, because a directory needs the execute bit to be entered at all. Take execute away from a directory and nobody can reach the files inside it, however readable they are.
When to use 755, and when not to
Use 755 for directories, for the reason just covered: entering a directory is an execute operation, and a directory the web server cannot enter serves nothing. Use it for executable scripts and programs, the setup the calculator's example calls the classic one: the owner can edit and run the script, everyone else can run it without being able to alter what it does.
Do not use it as a default for everything. A regular file that is never executed gains nothing from the execute bits, and 644 is tidier for it. A private file, a key or data only you should see, wants 600: owner read and write, the other digits zero, so no other user can even read it. And avoid 777 outright: it hands write access to every user on the machine, and a file anyone can modify is a file anyone can replace with something malicious.
Common mistakes
- Reading the digits in the wrong order. The owner is always first. A mode of 557 is not a stricter 755; it gives others more than the group.
- Setting 777 to make an error go away. It usually does silence the error, by removing all protection. Find the mode the software actually needs, almost always 755, 644 or 600.
- Forgetting that directories need execute. A directory set to 644 cannot be entered, so the files inside become unreachable.
- Putting execute on every file. Files served by a website rarely need it. Keep 644 for files and reserve 755 for directories and genuine executables.
- Trusting a number from memory. Modes are easy to transpose. Type the number into the calculator and read the checkboxes before running the command on a real file.
FAQs
How is each digit of 755 calculated? Each class adds up its permissions: read is 4, write is 2, execute is 1. Owner read, write and execute makes 7; group read and execute makes 5; others read and execute makes 5. That is how 755 is built.
What mode should a private file have? 600, owner read and write with nobody else getting anything, is the usual choice for keys and private data. Avoid 777, which lets every user on the system modify the file.
Why do directories use 755 while files use 644? A directory needs the execute bit to be entered at all, so directory modes usually sit one step higher than the file modes they pair with: 755 directories, 644 files. A plain file does not need to be executable, so its group and others digits stop at read.
What does the first character in ls -l output mean? That extra leading character is the file type, not a permission: d for directory, a dash for a regular file, l for a link. The nine characters after it are the symbolic permissions the calculator shows.
Can the calculator change permissions on my server? No. The calculator cannot see or change any real file. It only converts between representations, and gives you the ready-to-use chmod command to run yourself.
Conclusion
755 stops being a magic number once you see the sums inside it: 7 for the owner, 5 for the group and 5 for others, who can read and execute but never modify. That makes it right for directories and executable scripts, the wrong default for plain files (644) and far too open for private data (600). The Chmod Calculator lets you check any mode in both directions before applying it. If your checklist also includes shrinking the scripts those permissions protect, the companion guide How to Minify JavaScript Online covers the safe way, and more utilities like these live in the Developer Tools archive.