# How I understand chmod without guessing the numbers

A beginner-friendly guide to Linux file permissions, chmod numbers, symbolic modes, and using the chmod Calculator to avoid permission mistakes.

- Date: 2026-09-27
- URL: https://ilham.dev/posts/how-to-understand-chmod-permissions/
- Markdown: https://ilham.dev/posts/how-to-understand-chmod-permissions/index.md
- Tags: linux, chmod, permissions, tools
- Reading time: 4 min


`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](/tools/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:

```text
user group others
```

or shorter:

```text
u g o
```

Each group can have three permissions:

| Letter | Meaning |
| --- | --- |
| `r` | read |
| `w` | write |
| `x` | execute |

## Reading permission text

When you run:

```sh
ls -l
```

you may see:

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

Focus on this part:

```text
-rwxr-xr-x
```

The first character tells the type:

- `-` means regular file;
- `d` means directory.

The next nine characters are permissions:

```text
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:

```sh
./script.sh
```

Without execute permission, you may see:

```text
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:

```text
read    = 4
write   = 2
execute = 1
```

Add them together for each group.

Examples:

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

So this:

```text
755
```

means:

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

Readable form:

```text
rwxr-xr-x
```

## Common permission values

These are common, but do not copy them blindly:

| Mode | Meaning | Common use |
| --- | --- | --- |
| `644` | owner can write, everyone can read | normal public files |
| `600` | only owner can read/write | private config or keys |
| `755` | owner can write, everyone can read/execute | scripts and directories |
| `700` | only owner can access | private directories/scripts |

For private keys, `600` is common:

```sh
chmod 600 ~/.ssh/id_ed25519
```

For a script:

```sh
chmod 755 deploy.sh
```

or more narrowly:

```sh
chmod u+x deploy.sh
```

## Symbolic chmod is often easier

You do not always need numbers.

Add execute permission for the owner:

```sh
chmod u+x script.sh
```

Remove write permission from others:

```sh
chmod o-w file.txt
```

Set exact permissions for everyone:

```sh
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:

```sh
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](/tools/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:

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

Result:

```text
640
```

Command:

```sh
chmod 640 file.txt
```

## Step 4: apply and verify

Run the command:

```sh
chmod 640 file.txt
```

Then check again:

```sh
ls -l file.txt
```

Make sure the result matches what you intended.

## Be careful with recursive chmod

This command changes permissions recursively:

```sh
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:

```sh
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.
