Linux 101 : Files permissions
The chmod command helps us change the access permissions for our files.
The permissions of a file look like below:
- Read : 4
- Write : 2
- Execute : 1
To change the permissions of a file ''file1" to rw-r-xr--, we use the below:
Changing permission for the user, we use the "u" parameter.
To change the permissions of the group that the user belongs to, we use the "g" parameter.
For others, we we use the "o" parameter.
We use the "u" parameter to change the permission is all the "u : user" category.
To add a level of security to the files when we create them, a mask is applied to them to mask or cancel certain permissions at the creation of a file, for example when we create a file using the command "touch file".
We could make the permissions more restrictive at the creation of a file using the umask command followed by our mask.
For example the below command masks or prevents writing for group and others: