# chmod

> A command that changes who may read, write or run a file.

**Field:** Infrastructure  
**Category:** Linux & the Command Line  
**Also known as:** chmod Command, Change Mode, chmod 755, chmod 600

## Think of it like

Think of it like changing who is on the list for a club. The door stays the same, the list changes.

## Definition

chmod is the command that changes the permissions on a file or folder. You can give it three digits, one for the owner, the group and others. In each digit, 4 is read, 2 is write and 1 is run, added up. So 7 is all three and 6 is read and write. chmod 600 means only the owner may read and write the file.

## Example

Emma's private key file is open to everyone, and SSH refuses to use it. She runs chmod 600 on it, and SSH works.

## Example code

```console
$ chmod 600 key.txt
$ ls -l key.txt
-rw------- 1 emma emma 3381 Nov 16 14:02 key.txt
```

After chmod 600, only Emma may read or change the file.

## Why it matters

Secret files need tight rights, and scripts need the run right. chmod sets both.

## Common mistake

Using chmod 777 to make an error go away. It hides the real problem and opens the file to everyone.

## Three principles

- **4, 2, 1.** Read, write and run, added up.
- **Three digits.** Owner, group, then others.
- **600 for secrets.** Only the owner may read it.

## Related terms

- [File Permissions](https://learn.benibix.com/term/infrastructure/file-permissions)
- [chown](https://learn.benibix.com/term/infrastructure/chown)
- [User Group (Linux)](https://learn.benibix.com/term/infrastructure/user-group)
- [Hidden File (Dotfile)](https://learn.benibix.com/term/infrastructure/hidden-file)

## Told apart from

- [chmod vs chown](https://learn.benibix.com/compare/chmod-vs-chown): People often mix up chmod and chown because the names are so close. chmod changes what can be done to a file: read, write or run. chown changes who the file belongs to. A permission denied error can need either one, so read ls -l first and see which part is wrong.

## Taught in

- [Linux File Permissions](https://learn.benibix.com/learn/infrastructure-linux/linux-file-permissions): Linux CLI, 6/10
- [SSH Keys and ssh-keygen](https://learn.benibix.com/learn/infrastructure-ssh/ssh-keys-and-ssh-keygen): SSH, 3/9

![The line -rwxr-x--- lucy devs run.sh split into labelled parts. The first three letters rwx belong to the owner lucy and add up to 7. The next three r-x belong to the group devs and add up to 5. The last three dashes belong to everyone else and add up to 0. Under each letter, r is 4, w is 2 and x is 1.](https://learn.benibix.com/diagrams/inf3-permissions.svg)

---

Source: https://learn.benibix.com/term/infrastructure/chmod
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
