# chmod +x: Make a File Executable (u+x vs a+x)

> Adds execute permission, so a script or program can be run directly.

`chmod +x file` turns on the execute bit. With no `u`, `g` or `o` in front, chmod adds it for the owner, the group and everyone else — except where your umask masks it out.

It adds a bit and changes nothing else, which is why it's safer than reaching for a number like 755.

## What it changes

`-rw-r--r--` → `-rwxr-xr-x` (with the usual umask of 022)

## Examples

```
chmod +x deploy.sh && ./deploy.sh
```

make a script executable, then run it

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

execute for the owner only

```
chmod a+x deploy.sh
```

execute for everyone, regardless of umask

```
git update-index --chmod=+x deploy.sh
```

record the executable bit in Git — needed when committing from Windows

## Good to know

- A script also needs a shebang line such as `#!/usr/bin/env bash` as its first line; without one, the shell decides how to run it.
- On a filesystem mounted `noexec` (often `/tmp` or a USB drive), execution fails with "Permission denied" even after `chmod +x`. Run it through the interpreter instead: `bash script.sh`.
- Windows drives under WSL (`/mnt/c`) ignore chmod unless they're mounted with the `metadata` option.
- Only the file's owner (or root) can change its mode; anyone else gets "Operation not permitted".

## FAQ

### What is the difference between chmod +x and chmod 755?

`chmod +x` adds the execute bit and keeps everything else as it was. `chmod 755` sets the whole mode to rwxr-xr-x, discarding whatever was there. On a typical 644 file the result is the same.

### What is the difference between chmod +x and chmod u+x?

`u+x` gives execute permission to the owner only. `+x` with no class adds it for owner, group and others, minus any bits your umask masks — so with umask 077 it behaves like `u+x`.

### Why do I still get Permission denied after chmod +x?

Usually the filesystem is mounted `noexec`, or a directory on the path lacks execute (search) permission for you. A missing or wrong interpreter gives "bad interpreter" or "No such file or directory" instead.

## Related

- [chmod 755](https://www.devkult.com/chmod/755.md)
- [chmod 700](https://www.devkult.com/chmod/700.md)
- [chmod 775](https://www.devkult.com/chmod/775.md)
- [chmod -R](https://www.devkult.com/chmod/recursive.md)
- [chmod u+s](https://www.devkult.com/chmod/u-plus-s.md)

Open the interactive page: https://www.devkult.com/chmod/plus-x