CHMOD | PERMISSIONS CONVERTER
Tags: linux, unix, chmod, tooling
Published: 2022-12-28 17:09:02

{% embed https://www.permissions-converter.com/ %}

I share with all of you this very useful web page to consult some kind of permissions for our files. I understand that for more advanced users it will not be useful at all and may even seem silly, but it has saved me from many.

You just enter the permissions and that's it!


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yvp3te4u52q4psejnzbf.png)

⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀⥀


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5yq25k3eqc7qcd88chvs.png)

And now for the more curious I will try to explain how to understand the conversion so that we don't have to rely on anything.
In Linux and other Unix-like operating systems, file permissions determine who can access and modify files and directories. File permissions are specified using a three-digit octal (base-8) notation, which represents the permissions for the **owner**, **group**, and **others** (also known as "world").

Here's an example of how to convert permissions from the octal notation (777) to the symbolic notation (rwxrwxrwx):


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jo6xp431e6m2lpeah2j7.png)

1. Start with the octal notation (777). This represents the permissions for the owner, group, and others.

2. Break down the octal notation into its **individual digits**. In this case, the first digit is 7, the second digit is 7, and the third digit is 7.

3. Convert each digit to its corresponding symbolic notation. In the symbolic notation, **"r"** represents **read** permission, **"w"** represents write **permission**, and **"x"** represents **execute** permission.If the digit is 0, it means that the corresponding permission is not set.

- If the digit is **1**, it means that the corresponding permission is set to **execute only**.
- If the digit is **2**, **write only**.
- **3**, **write and execute**.
- **4**, **read only**.
- **5**, **read and execute**.
- **6**, **read and write**.
- **7**, **read, write, and execute**.

4. Combine the symbolic notation for each digit to get the final result. In this case, the octal notation 777 is equivalent to the symbolic notation rwxrwxrwx.

For example, if you have a file with permissions set to 777, it means that the owner has read, write, and execute permissions; the group has read, write, and execute permissions; and others have read, write, and execute permissions. This is equivalent to the symbolic notation rwxrwxrwx.

---

And now that we understand it a little better, we will see how to apply the chmod command and what it works for.
The `chmod` command is used to change the permissions of a file or directory in Linux and other Unix-like operating systems. You can use `chmod` to grant or revoke permissions for the **owner**, **group**, and **others**.
Here's an example of how to use the `chmod` command to change the permissions of a file or directory from 777 (rwxrwxrwx) to 755 (rwxr-xr-x) using the octal notation:

1. Open a terminal window.
2. Use the `cd` command to navigate to the directory that contains the file or directory whose permissions you want to change. For example:

```
cd /path/to/directory
```

3. Type `chmod` followed by the octal notation for the desired permissions and the name of the file or directory. For example:

```
chmod 755 file.txt
```

4. This will change the permissions of the file `file.txt` to 755 (rwxr-xr-x).

You can also use the `chmod` command with the symbolic notation to specify permissions. For example, to change the permissions of a file or directory from 777 (rwxrwxrwx) to 755 (rwxr-xr-x) using the symbolic notation, you can use the following command:

```
chmod u=rwx,g=rx,o=rx file.txt
```

This will change the permissions of the file file.txt to 755 (rwxr-xr-x). The u represents the **owner**, the `g` represents the group, and the o represents others. The `=` symbol means **"set to"** and the `,` symbol **separates** the different permissions.
You can also use the `chmod` command with the `-R` option to recursively change the permissions of all files and directories inside a directory. For example:

```
chmod -R 755 /path/to/directory
```

This will change the permissions of all files and directories inside the `/path/to/directory` directory and all its subdirectories to 755 (rwxr-xr-x).

---

And this has been all my people, I hope to help, I am more interested in understanding the permissions than in using the shared resource.