Linux :To Check File and Folder Permissions in Linux

|

Do You Know Who the User, Group, and Others Are in Linux?

A Linux system stores many important files and folders that are used by the operating system and its users. To prevent unauthorized users from accessing them, permissions are assigned to every file and folder. These permissions determine who can read, write, and execute a file or directory, helping keep important data secure.

When you check file or folder permissions in Linux, the access rights are divided into three categories:

  1. User (Owner): When a user creates a file or directory, they become the owner and have full permissions, including read, write, and execute.
  2. Group (Group Members): Users who belong to the same group can access the file or folder according to the permissions given by the owner. Without execute permission, they cannot enter a directory or execute a file.
  3. Others: All users who are neither the owner nor members 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 gave the required permissions to the group. Any users who are not the owner or members of the group are placed under Others and receive the permissions set by the owner.

  1. User (Owner → Shobha): Can read, write, and execute.
  2. Group (Amit and Riya): Can read and write but cannot execute.
  3. Others (Neha): Can only read and cannot write or execute.

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, check your file or folder permissions using the ls -l command.

Step 2: Then, you will see output similar to this:

-rwxr-xr---
drwxr-xr-x 2 shobha admin 4096 Sep 07 12:05 project

Step 3: Now, analyze the output:

For Files:

Permissions: -rwxr-xr---
[ User ]   [ Group ]   [ Others ]
  rwx         r-x         r--
  1. User: It can read, write, and execute.
  2. Group: It can read and execute.
  3. Others: It can only read the file.

For Folders:

Permissions: drwxr-xr-x
  1. User: It can read, write, and enter (execute).
  2. Group: It can read and enter the directory.
  3. Others: It can read and enter the directory.

ONLINE WEB TOOLS

WhatIsMyIpAddress
Shorterner