1.0 KiB
1.0 KiB
Changing permissions for files and directories
There are three types of permissions for files and directories in the system:
- Read ('r')
- Write ('w')
- Execute ('x')
The permissions can be differente for users: owner - group - others
Creating a file and checking permissions
Here we create a file with the sentence "this is a fancy file". The sentence is redirected to the name "fancyfile.org" and a new file is created!
echo "this is a fancy file" > fancyfile.org
In the ouptut of ls
command, there letters showing each permission for each user: owner, group, others, respectively.
ls -la fancyfile.org
-rw-r--r-- 1 compartido compartido 21 jul 18 06:06 fancyfile.org
Settings permissions for the file
chmod o=r,g=rw,o=r fancyfile.org
Then it changed!
ls -la fancyfile.org
-rw-rw-r-- 1 compartido compartido 21 jul 18 06:06 fancyfile.org