Linux File Permission(Part-1)

Linux File Permission(Part-1)

What is file permission?

File permissions in Linux determine who can read, write, or execute files and directories on the system, providing security and access control.


Types of File Permission:

The three primary types of file permissions in Linux are:

1. Read (r): Allows a user to view the contents of a file or list the contents of a directory.

2. Write (w): Permits a user to modify the content of a file or create, delete, and rename files within a directory.

3. Execute (x): Grants the user the ability to execute a file as a program or access files within a directory.


Types of Permission Groups:

In Linux file permissions:

1. Owner: Represents the user who owns the file. Permissions are typically specified for the file's owner using "r" (read), "w" (write), and "x" (execute) flags.

2. Group: Refers to a group of users who have the same group permissions for the file. Permissions for the group are also specified using "r," "w," and "x" flags.

3. Other: Denotes all other users who are not the owner and not in the group. Permissions for others are also specified using "r," "w," and "x" flags.


File Permission Distribution:

Article content

The string "drwxrwxrwx" represents file permissions in Linux. Here's a breakdown of what each character or symbol means:

1. d: The first character, "d," indicates that this is a directory. If it were a regular file, it would be represented as a hyphen ("-").

2. rwx: The next three characters, "rwx," represent the permissions for the file's owner. In this case, the owner has read (r), write (w), and execute (x) permissions on the directory.

3. rwx: The following three characters represent the permissions for the group. In this example, the group also has read, write, and execute permissions.

4. rwx: The final three characters represent the permissions for others or everyone else. In this case, others also have read, write, and execute permissions.


Symbolic Mode in File Permission:

Article content

Q1 How to remove permission for user/owner in Linux?

-before changing permission

Article content
chmod u-<permission> <file_name>        
Article content

Q1 How to add permission for user/owner in Linux?

-Before changing permission

Article content
chmod u+<permission> <file_name>        
Article content

Q2 How to remove permission for group in Linux?

-Before changing permission

Article content
chmod g-<permission> <file_name>        
Article content

Q4 How to add permission for group in Linux?

-Before changing permission

Article content
chmod g+<permission> <file_name>        
Article content

Q5 How to remove permission for others in Linux?

-Before changing permission

Article content
chmod o-<permission> <file_name>        
Article content

Q6 How to add permission for others in Linux?

-Before changing permission

Article content
chmod o+<permission> <file_name>        
Article content

Now, Did you notice that when we added "rwx" permission to other the folder named "linux" is highlighted why?

-When we give whole privilege to any file , It's not allowed in linux because of security purposes.

Article content

So, whether you're a seasoned Linux pro or just beginning your Linux journey, take a moment to appreciate the elegance of Linux File Permission. It's the foundation of a world where you have the power to control and customize your computing environment.

With that, happy Linux learning, and may your Linux directory explorations be filled with joy and success!

Muhammad Irfan

Linux System Administrator | AWS Cloud Enthusiast | Aspiring DevOps Engineer | Help Students in Career Building | Tech Blog Writer

1y

Awesome Gauri Yadav Thank you so much for valuable guidelines.

Like
Reply

To view or add a comment, sign in

Others also viewed

Explore topics