Changing the file permissions using the chmod command
Change Mode or chmod is a Linux command that is used to modify the access permissions of files and directories. Everybody wants to keep their data secure and properly organized. For this reason, Linux has a concept that associates owners and groups with every file and directory. These owners and groups have different permissions to access a particular file.
Getting ready
Before we take a look at the different usages of the chmod
command, we need to know the different types of users and the symbolic representation used:
u
is used for user/ownerg
is used for a groupo
is used for others
Now, create a file called testfile.txt
, to try out the different commands of chmod
.
How to do it…
Now, we will take a look at how to use chmod
in different ways in order to set different permissions:
- If we want to change a single permission for users (owners, groups, or others), we use the
+
symbol to add the permission, as shown in the following command...