> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# chmod 755 Explained: Linux File Permissions, chmod and chown

> chmod 755 explained: the owner can read, write and execute, everyone else can read and execute. Learn Linux permission numbers, chmod, chown and safe values.

`chmod 755` gives the owner read, write and execute permission (7 = 4 + 2 + 1) and gives the group and everyone else read and execute (5 = 4 + 1). In `ls -l` it shows as `rwxr-xr-x`. Use 755 for directories and scripts, 644 (`rw-r--r--`) for normal files, and change the owner with `chown`, for example `sudo chown alex:www-data file`.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Beginner | 10 minutes | Every Linux distribution | sudo for files you don't own |

## Before you start

* [Connect with SSH](https://help.freakhosting.com/portals/other/how-to-connect-to-a-linux-server-with-ssh.md). You can change permissions on your own files; for other files you need `sudo` (root can leave it out).
* Take a [backup or snapshot](https://help.freakhosting.com/portals/vps-panel/how-to-schedule-and-restore-backups.md) before you change permissions recursively on a large folder.

## How to read Linux permissions

Run `ls -l`:

```bash theme={null}
ls -l deploy.sh
```

```text theme={null}
-rwxr-xr-x 1 alex www-data 2048 Nov  4 13:27 deploy.sh
```

| Part | Meaning |
| - | - |
| `-` | Type: `-` file, `d` directory, `l` link |
| `rwx` | **Owner** (`alex`) can read, write, execute |
| `r-x` | **Group** (`www-data`) can read and execute |
| `r-x` | **Others** (everyone else) can read and execute |

Each letter has a number. Add them up for each of the three positions:

| Letter | Number | On a file | On a directory |
| - | - | - | - |
| `r` read | 4 | Open and read it | List the names inside |
| `w` write | 2 | Change it | Create, delete or rename files inside |
| `x` execute | 1 | Run it as a program | Enter it (`cd`) and open files inside |

## What do chmod 755, 644, 600 and 777 mean?

| Number | Letters | Owner | Group | Others | Typical use |
| - | - | - | - | - | - |
| `755` | `rwxr-xr-x` | all | read, execute | read, execute | Directories, scripts, programs |
| `644` | `rw-r--r--` | read, write | read | read | Normal files, web pages |
| `640` | `rw-r-----` | read, write | read | none | Config files with secrets read by a service group |
| `600` | `rw-------` | read, write | none | none | Private keys, `authorized_keys` |
| `700` | `rwx------` | all | none | none | `~/.ssh` and private folders |
| `775` | `rwxrwxr-x` | all | all | read, execute | Shared group folders |
| `777` | `rwxrwxrwx` | all | all | all | Avoid it |

> [!WARNING]
>
> Don't "fix" a permission error with `chmod 777`. It lets every user and every process on the server change or replace the file, which is a common way websites get hacked. Find out which user needs access and give only that user or group the rights it needs.

## How to change permissions with chmod

**1. Set permissions with numbers**

```bash theme={null}
chmod 755 deploy.sh
chmod 644 index.html
```

**2. Or change one part with letters**

`u` = owner, `g` = group, `o` = others, `a` = all. `+` adds, `-` removes, `=` sets exactly.

```bash theme={null}
chmod +x deploy.sh        # make it executable for everyone
chmod g+w report.csv      # let the group write
chmod o-rwx secrets.env   # remove all rights for others
chmod u=rw,go=r page.html # same as 644
```

**3. Check the result**

```bash theme={null}
stat -c '%A %a %n' deploy.sh
```

Expected output:

```text theme={null}
-rwxr-xr-x 755 deploy.sh
```

### How to set different permissions for files and directories

`chmod -R 755` makes every file executable, which you rarely want. Use `find` to treat them separately, for example for a website:

```bash theme={null}
sudo find /var/www/example.com -type d -exec chmod 755 {} +
sudo find /var/www/example.com -type f -exec chmod 644 {} +
```

## How to change the owner with chown

```bash theme={null}
sudo chown alex report.csv               # change owner
sudo chown alex:www-data report.csv      # change owner and group
sudo chown :www-data report.csv          # change only the group (or use chgrp)
sudo chown -R alex:www-data /var/www/example.com   # whole folder
```

The web server user is `www-data` on Ubuntu and Debian, and `nginx` or `apache` on AlmaLinux and Rocky Linux, depending on which web server you installed.

> [!WARNING]
>
> Never run `chown -R` or `chmod -R` on `/`, `/etc`, `/usr` or `/var` as a whole. Changing system ownership breaks sudo, SSH and other services, and the only reliable fix is a [restore from backup](https://help.freakhosting.com/portals/vps-panel/how-to-schedule-and-restore-backups.md) or a reinstall. Double-check the path before pressing `Enter`.

## Special permissions: setgid and sticky bit

| Bit | Number | Effect | Example |
| - | - | - | - |
| setgid on a directory | `2` | New files get the directory's group | `chmod 2775 /srv/shared` → `drwxrwsr-x` |
| sticky bit on a directory | `1` | Users can only delete their own files (as in `/tmp`) | `chmod +t /srv/upload` → `drwxrwxrwt` |
| setuid on a program | `4` | Runs as the file's owner | Used by `passwd`; don't set it on your own scripts |

## What is umask?

`umask` sets the default permissions for new files. The usual value `0022` makes new files `644` and new directories `755`. Check yours with `umask`.

## How to check it worked

Test as the user who needs access, for example the web server user:

```bash theme={null}
sudo -u www-data cat /var/www/example.com/index.html
```

If the file prints, the permissions are right. `Permission denied` means the user is missing `r` on the file or `x` on one of the parent directories. `namei -l /var/www/example.com/index.html` shows the permissions of every directory in the path.

## Frequently asked questions

### What is the difference between chmod 755 and 644?

755 adds execute (`x`). Directories need `x` so you can open them, and scripts need it to run. Plain files such as HTML, images and config files don't, so they use 644.

### What permissions should `~/.ssh` have?

`~/.ssh` must be `700` and `~/.ssh/authorized_keys` `600`, owned by the user. SSH refuses keys when they are more open. See [fix SSH "Permission denied (publickey)"](https://help.freakhosting.com/portals/other/how-to-fix-ssh-permission-denied-publickey.md).

### What does chmod +x do?

It adds execute permission for the owner, group and others (limited by your umask), so you can run the file with `./script.sh`.

### Why does chmod say "Operation not permitted"?

Only the owner or root can change a file's permissions. Use `sudo`, or check the owner with `ls -l`.

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every server guide in one place.

> [card] [Manage users and groups](https://help.freakhosting.com/portals/other/how-to-manage-users-and-groups-on-linux.md)
>
> Put users in shared groups.

> [card] [Essential Linux commands](https://help.freakhosting.com/portals/other/essential-linux-commands-for-server-beginners.md)
>
> The commands you use every day.

> [card] [Find files and text](https://help.freakhosting.com/portals/other/how-to-find-files-and-text-on-linux.md)
>
> Search with find and grep.

***

> [!NOTE]
>
> **Checked against the official [GNU Coreutils manual: chmod, chown and file modes](https://www.gnu.org/software/coreutils/manual/html_node/File-permissions.html)** on 4 November 2026; commands tested on Ubuntu 24.04 LTS. Commands can differ on other distributions or releases.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.