# Change Folder and Subfolder Permissions in Linux

> Use chmod -R with permission flags to recursively change permissions on a folder, its subfolders, and files, with capital X to limit execute to directories

**URL:** https://sentry.io/answers/change-permissions-for-a-folder-and-subfolders-in-linux/

---

## The Problem

In Linux, how do I change the permissions on a folder, its subfolders, and its files?

## The Solution

You can do this using the [`chmod`](https://en.wikipedia.org/wiki/Chmod) `-R` or `--recursive` flag, which will apply the operation to all files and subdirectories. For example, to allow all users to read files and enter (i.e. execute) subdirectories in `myfolder`, we could use the following command:

```bash
chmod -R a+rX myfolder
```

* `a`: all users.
* `+`: add the following permissions.
* `r`: read permission.
* `X`: execute permission, but only for directories.

To learn more about `chmod`, open its [manual page](https://en.wikipedia.org/wiki/Man_page) by entering `man chmod`.

---

*Source: [sentry.io/answers/change-permissions-for-a-folder-and-subfolders-in-linux/](https://sentry.io/answers/change-permissions-for-a-folder-and-subfolders-in-linux/)*
