Showing posts with label Linux file permissions. Show all posts
Showing posts with label Linux file permissions. Show all posts

Tuesday, January 31, 2023

Linux - Permission required to read a file in a folder

 1. If you are the owner of a directory, owner should have readable and executable permission for the directory to cd into it or list the content of the directory.

If you are not the owner of a directory, other users should have readable and executable permission for the directory to cd into it or list the content of the directory.

Click on it to read the content



2.
If you are the owner of a directory and owner has only readable permission for the directory, owner can list the files and sub-directories inside directory but owner cannot read the content of the files or list the content inside sub-directories. Owner cannot cd into the directory.

Click on it to read the content


If you are not the owner of a directory and other user has only readable permission for the directory, other users can list the files and sub-directories inside directory but owner cannot read the content of the files or list the content inside sub-directories. Other users cannot cd into the directory.

3. If you are the owner of a directory and owner has only executable permission for the directory, owner cannot list the files and sub-directories inside directory but owner can read the content of the files if owner knows the file name. Owner can cd into the directory.

If you are not the owner of a directory and other user has only executable permission for the directory, other user cannot list the files and sub-directories inside directory but other user can read the content of the files if other user knows the file name. Other user can cd into the directory.

Click on it to read the content


4. Complete directory structure of files and sub-directories follows above rules.

If any of the sub directories has missed the correct readable and executable permissions, the files and sub-directories of the directory cannot be listed or read based on the given permissions to parent directory. 

 

Click on it to read the content

If a sub-directory or a file has full permission but parent directory does not have readable or executable or both permissions then sub-directory content or files cannot be listed or read
based on the given permissions to parent directory.

Friday, December 26, 2014

Understanding Linux File Permissions

Linux File Permissions :

Understanding Linux File & Directory Permissions :



Linux File and directory Permission mechanism

Read Write Execute
Owner 400 200 100
Group 40 20 10
Others 4 2 1


If you want to give Read, Write & Execute permission to Owner, Groups & Others, it means full permission.
400+200+100+40+20+10+4+2+1 = 777

If you do not want to give Write permission to Groups Others, it means 
400+200+100+40+10+4+1 = 755

The best thing of this calculation, you can not make sum of a number in two different ways .
It means 644 can be made in this way only that is 400+200+40+4
The meaning of 644 is Read & Write permission to Owner and Read permission to Group and Others only.

To give 777 to a directory :

# chmod -R 777 /path/of/the/directory

where -R means Recursive, it means give this permission to all sub-directories and files.

To give 777 to a file :
# chmod 777 /path/of/the/file
Now you can create & give permissions by your own.