# File Permissions

On a Linux operating system, each file and directory is assigned access permissions for the owner of the file, the members of a group of related users and everybody else. This is to make sure that one user is not allowed to access the files and resources of another user.

![](https://1588585907-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTwgToRvLjYdjfpAVgP%2Fuploads%2FlTmWlFX5eONVgTcRbEFv%2Fimage.png?alt=media\&token=b804189f-cc03-42fb-9864-31bd7430aeee)

![](https://1588585907-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTwgToRvLjYdjfpAVgP%2Fuploads%2FvvfjtneBbRcHpyMuhOHc%2Fimage.png?alt=media\&token=2bbde974-c585-4ae5-b861-907a5c60ca05)

![](https://1588585907-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTwgToRvLjYdjfpAVgP%2Fuploads%2FkX6qCibHNJGuzgYqimyo%2Fimage.png?alt=media\&token=658a8486-7a4f-492b-8f26-bbbe2903739f)

#### Chmod command <a href="#chmod-command" id="chmod-command"></a>

The chmod command is used to modify files and directories permissions in Linux.

The chmod command accepts permissions in as a numerical argument. We can think of permission as a series of bits with 1 representing True or allowed and 0 representing False or not allowed.

| Permission              | rwx | Binary | Decimal |
| ----------------------- | --- | ------ | ------- |
| Read, write and execute | rwx | 111    | 7       |
| Read and write          | rw- | 110    | 6       |
| Read and execute        | r-x | 101    | 5       |
| Read only               | r-- | 100    | 4       |
| Write and execute       | -wx | 011    | 3       |
| Write only              | -w- | 010    | 2       |
| Execute only            | --x | 001    | 1       |
| None                    | --- | 000    | 0       |

Each digit is independent of the other two. Therefore, `750` means the current user can read, write, and execute, the group cannot write, and others cannot read, write, or execute.

`744`, which is a typical default permission, allows read, write, and execute permissions for the owner, and read permissions for the group and “world” users.

#### `664 => rw-rw-r--` <a href="#chmod-664-rw-rw-r" id="chmod-664-rw-rw-r"></a>

```
chmod 664 example.txt
```

\
**Chown command**

The chown command is used to change the owner of files or directories in Linux.

Command syntax: chown \\\<new\_owner> \\\<file\_name>

![](https://linkedin.github.io/school-of-sre/level101/linux_basics/images/linux/admin/image6.png)

**Chgrp command**

The chgrp command can be used to change the group ownership of files or directories in Linux. The syntax is very similar to that of chown command.

![](https://linkedin.github.io/school-of-sre/level101/linux_basics/images/linux/admin/image27.png)

Chgrp command can also be used to change the owner of a directory in the similar way.\ <br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.mikaelsamvelian.com/linux-fundamentals/server-administration/file-permissions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
