chmod 755 is one of those commands many people copy before they fully understand it. It works often enough that it becomes a habit, but file permissions are worth understanding properly.

The chmod Calculator helps translate between the numbers and the readable permission bits. I use it when I want to check the result instead of guessing.

The simple idea

Linux file permissions answer three questions:

  1. What can the owner do?
  2. What can the group do?
  3. What can everyone else do?

Those three groups are usually shown as:

user group others

or shorter:

u g o

Each group can have three permissions:

LetterMeaning
rread
wwrite
xexecute

Reading permission text

When you run:

ls -l

you may see:

-rwxr-xr-x 1 ubuntu ubuntu 1234 app.sh

Focus on this part:

-rwxr-xr-x

The first character tells the type:

  • - means regular file;
  • d means directory.

The next nine characters are permissions:

rwx r-x r-x
│   │   │
│   │   └─ others
│   └───── group
└───────── owner/user

So rwxr-xr-x means:

  • owner can read, write, and execute;
  • group can read and execute;
  • others can read and execute.

What read, write, and execute mean for files

For files:

  • r means you can read the file;
  • w means you can modify the file;
  • x means you can run it as a program or script.

A shell script usually needs execute permission if you want to run it like this:

./script.sh

Without execute permission, you may see:

Permission denied

What read, write, and execute mean for directories

Directories are a little different.

For directories:

  • r means you can list names inside the directory;
  • w means you can create, delete, or rename entries inside it;
  • x means you can enter or traverse the directory.

The x permission on directories is important. Without it, you may not be able to access files inside even if you know their names.

Understanding chmod numbers

The number form uses these values:

read    = 4
write   = 2
execute = 1

Add them together for each group.

Examples:

rwx = 4 + 2 + 1 = 7
rw- = 4 + 2     = 6
r-x = 4 + 1     = 5
r-- = 4         = 4
--- = 0

So this:

755

means:

7 = owner: rwx
5 = group: r-x
5 = others: r-x

Readable form:

rwxr-xr-x

Common permission values

These are common, but do not copy them blindly:

ModeMeaningCommon use
644owner can write, everyone can readnormal public files
600only owner can read/writeprivate config or keys
755owner can write, everyone can read/executescripts and directories
700only owner can accessprivate directories/scripts

For private keys, 600 is common:

chmod 600 ~/.ssh/id_ed25519

For a script:

chmod 755 deploy.sh

or more narrowly:

chmod u+x deploy.sh

Symbolic chmod is often easier

You do not always need numbers.

Add execute permission for the owner:

chmod u+x script.sh

Remove write permission from others:

chmod o-w file.txt

Set exact permissions for everyone:

chmod u=rw,g=r,o= file.txt

Plain meaning:

  • owner can read/write;
  • group can read;
  • others get no permission.

Symbolic mode is useful because it says what you are changing instead of forcing you to calculate the full number.

Step 1: inspect before changing

Before running chmod, check the current permission:

ls -l file.txt

Do not change permissions blindly. First see what they are.

Step 2: decide who needs access

Ask:

  1. Should only the owner access this?
  2. Should the group access it?
  3. Should everyone else access it?
  4. Is execute permission really needed?

For example, a config file usually does not need execute permission.

Step 3: use the chmod Calculator

Open chmod Calculator and choose the permissions you want.

The tool shows the numeric and symbolic forms. This is useful when you know the human rule but do not want to calculate the number manually.

Example decision:

owner: read/write
group: read
others: no access

Result:

640

Command:

chmod 640 file.txt

Step 4: apply and verify

Run the command:

chmod 640 file.txt

Then check again:

ls -l file.txt

Make sure the result matches what you intended.

Be careful with recursive chmod

This command changes permissions recursively:

chmod -R 755 directory

Be careful. It applies to everything inside the directory.

A common mistake is making every file executable. Directories often need execute permission, but normal files usually do not.

For complex permission fixes, use find to target files and directories separately:

find directory -type d -exec chmod 755 {} +
find directory -type f -exec chmod 644 {} +

That gives directories and files different permissions.

My chmod checklist

Before changing permissions, I check:

  1. What are the current permissions?
  2. Who owns the file?
  3. Does the owner need read, write, execute?
  4. Does the group need access?
  5. Should others have any access?
  6. Is this a file or directory?
  7. Am I using recursive mode accidentally?
  8. Did I verify with ls -l after changing it?

The goal is not to memorise every number. The goal is to understand who can do what. The calculator turns that decision into the correct mode.

Comments

Comments are welcome — please read the comment policy first. Powered by giscus and GitHub Discussions.