---
title: "How do I change permissions in Linux for a folder and its subfolders/files?"  
description: "How do I change permissions in Linux for a folder and its subfolders/files?"  
author: "Utpal Vishwas"  
published: 2023-07-14  
updated: 2023-07-15  
canonical: https://www.mindstick.com/forum/159087/how-do-i-change-permissions-in-linux-for-a-folder-and-its-subfolders-files  
category: "exception handling"  
tags: ["file", "linux"]  
reading_time: 2 minutes  

---

# How do I change permissions in Linux for a folder and its subfolders/files?

How do I change permissions in [Linux](https://www.mindstick.com/blog/11489/linux-os) for a folder and its subfolders/[files](https://www.mindstick.com/articles/23302/the-importance-and-advantage-of-keeping-your-important-files-on-the-cloud)?

## Replies

### Reply by Aryan Kumar

Sure, there are a few ways to change permissions in Linux for a folder and its subfolders/files. Here are two methods:

**Method 1: Using the** `chmod` **command**

The `chmod` command is a command-line tool that can be used to change the permissions of files and directories. To change the permissions of a folder and its subfolders/files, you can use the following syntax:

```plaintext
chmod <permissions> <directory_path>
```

For example, to change the permissions of the directory `/home/user/my_directory` to read, write, and execute for the owner, read and execute for the group, and no permissions for others, you would run the following command:

```plaintext
chmod 755 /home/user/my_directory
```

The `<permissions>` parameter can be a combination of the following characters:

- `r`: Read permission
- `w`: Write permission
- `x`: Execute permission

The `<directory_path>` parameter is the path to the directory that you want to change the permissions for.

**Method 2: Using the** `chown` **command**

The `chown` command is a command-line tool that can be used to change the ownership of files and directories. To change the ownership of a folder and its subfolders/files, you can use the following syntax:

```plaintext
chown <owner> <group> <directory_path>
```

For example, to change the ownership of the directory `/home/user/my_directory` to the user `user` and the group `group`, you would run the following command:

```plaintext
chown user:group /home/user/my_directory
```

The `<owner>` parameter is the name of the user that you want to give ownership of the directory to.

The `<group>` parameter is the name of the group that you want to give ownership of the directory to.

**Method 3: Using the** `sudo` **command**

If you are not the owner of the directory, you can use the `sudo` command to change the permissions. To change the permissions of a directory and its subfolders/files using the `sudo` command, you can use the following syntax:

```plaintext
sudo chmod <permissions> <directory_path>
```

For example, to change the permissions of the directory `/home/user/my_directory` to read, write, and execute for the owner, read and execute for the group, and no permissions for others, you would run the following command:

```plaintext
sudo chmod 755 /home/user/my_directory
```

The `sudo` command allows you to run commands as the root user, which has full permissions on the system.


---

Original Source: https://www.mindstick.com/forum/159087/how-do-i-change-permissions-in-linux-for-a-folder-and-its-subfolders-files

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
