To Check File and Folder Permissions in Linux
To Check File and Folder Permissions in Linux
The following steps will help you check your file and folder permissions in Linux.
Step 1: First, you will check your file’s or folder’s permissions using the ls -l command.
Step 2: Then, you will see output in the terminal like this:
-rwxr-xr--- drwxr-xr-x 2 shobha admin 4096 Sep 07 12:05 project
Step 3: Now, you can analyze the output:
For Files:
Permissions: -rwxr-xr--- [ User ] [ Group ] [ Others ] rwx r-x r--
- User: It can read, write, and execute.
- Group: It can read and execute.
- Others: It can only read the files.
For Folders:
Permissions: drwxr-xr-x
- User: It can read, write, and enter (execute).
- Group: It can read and enter the directory.
- Others: It can read and enter the directory.
Do You Know Who the User, Group, and Others Are in Linux?
When you check file or folder permissions in Linux, the access rights are divided into three categories:
- User (Owner): When a person creates a file or directory, they become the owner and have full permissions, including read, write, and execute.
- Group (Group Members): When the owner adds users to a group and gives them permissions, they become group members. They can use the file or folder but cannot open a folder or run a file without execute permission.
- Others: All users who are neither the owner nor part of the group. They generally have limited access.
Example:
Suppose there are four users on a Linux system:
- Shobha
- Amit
- Riya
- Neha
Explanation:
Here, Shobha created the file. She chose some users to form a group for the file and gave them the required permissions. Any users who are not part of the owner or group are placed under Others and given the permissions set by the owner.
- User (Owner → Shobha): Can read, write, and execute.
- Group (Amit and Riya → team): They can read and write but cannot execute.
- Others (Neha): She can only read, cannot write or execute.
