File Permissions
About Permissions
Here's a long listing of a file I've created with the touch command:
1-rw-rw-r-- 1 osboxes osboxes 0 Jan 7 07:30 myfile
This is the explanation to the first field you see:
Where:
- r means read
- w means write
- x means execute The numbers specify the values in binary converted to octal, so you can specify each 3 bits using single octal number.
Changing permission with chmod Using letters
- Create a file in the current directory
- change the permissions of this file, so that everybody can write/read/execute the file.
Use only letters, for example:
chmod u+x myfile - remove everything for everybody else, and leave read/write/execute just for the user.
Changing permissions with chmod Using octal numbers
- example:
6(octal) translates to 110(binary)
so 6 actually means read+write but not execute.
So: 664 menas read+write but not execute to owner and group, but only read for everybody else.
1$ chmod 664 myfile
2$ ls -l myfile
3-rw-rw-r-- 1 osboxes osboxes 0 Jan 7 07:30 myfile
4$
- Set the following:
user:r-x group r-- others: r-x