chmod 777: Change Permissions

In this article, we cover how chmod 777 is used to change the permissions of files and directories. But, to understand that, we need to first cover chmod itself. For system administrators, it is important to define file and directory permissions. In Linux, there are users, groups, and others.

And, we can’t share all the resources with everyone in our system. There could be files and directories that will have restricted access. Only certain users and groups can access such files and directories. Apart from that, there are three file and directory permissions we have: read, write, and execute.

Now, who gets to have read, write, and execute permissions can be decided by assigning octal values.

So, read gets an octal value of 4. 2 for write, and 1 for execute. This leads us to the below-mentioned possible combinations:

7: read, write, and execute

6: read and write

5: read and execute

4: read

3: write and execute

2: write

1: execute

If we want users to have read and write permissions. While the group and others can only read. Then,

chmod 644 <file/directory-name>

You can check for the new permissions through:

ls -l  <file/directory-name>

It should be:

-rw-r--r--

That is how chmod works. Now, coming to the reason for writing the article, chmod 777.

chmod 777: Change Permissions

What we have learned from the above is that the chmod command-line utility is used to modify file and directory permissions. And, one of the methods to achieve that is by using octal values.

As we have already covered 7 is for read, write, and execute permissions. So, when we use chmod 777 then we allow all the users, groups, and others to have read, write, and execute permissions.

chmod 777 <file/directory-name>

Again, we can check through the following command:

ls -l <file/directory-name>

It should be:

-rwxrwxrwx

Is it okay for all everyone to read, write, and execute? You can do so on a use-case basis. If the conditions require you to do so then, go ahead. But, in general, we shouldn’t do so. If the files are sensitive then they can pose a security risk. Something that we wouldn’t want.

In conclusion, we have covered here how to change file permissions through octal values. Then, it was about chmod 777 which lets everyone have read, write, and execute file/directory permission.

Similar Posts