Hello..! Today is a Day 04 of my #90DayOfDevOps Challenge
and today we are going through some of the Important topic File Persmissions.
So Lets get Started,
When it comes to managing files in Linux, understanding file permissions is super important. Since Linux is a multi-user operating system, file permissions make sure that different users and processes can only access the files they are allowed to use.
Basics of File Permission
Every file and directory has permissions that determine who can read, write, or execute it. These permissions are divided into three categories:
User (u): The owner of the file.
Group (g): A set of users who share certain rights.
Others (o): Anyone else who is not the owner or part of the group.
They each have three types of permissions:
Read (r): Permission to view the file contents or list the directory's contents.
Write (w): Permission to modify the file or directory.
Execute (x): Permission to run a file as a program or script.
These permissions can be represented in a format like rwxr-xr--
, where each set of three characters corresponds to the user, group, and others, respectively.
Understanding Permission Notation
When you run the ls -l
command in Linux to list the contents of a directory, you’ll see a column displaying file permissions in a format similar to this
-rwxr-xr--
Indication of the file:
-
for a regular file.d
for a directory.rwx
: The user (owner) has read, write, and execute permissions.r-x
: The group has read and execute permissions, but no write access.r--
: Others have read-only permission.
Changing Permissions with chmod
The chmod
command is used to change file permissions in Linux. Permission is represented by a number.
chmod [permission] filename
Example: To give the owner full permissions (7), the group read and execute (5), and others read-only (4), we have to use something like.
chmod 754 filename
for knowing the number of the Exact permission I created a Table where you can find on which number which permission is there..!
Example2: To give the owner full permissions (7), the group read (4) , and others execute only (1), we have to use something like.
chmod 741 filename
By the end of this process, I really got the hang of Linux file permissions. I learned how to set and change permissions for users, groups, and others.
Stay tuned for more insights as I continue my #90DayOfDevOps challenges. If you have any questions or tips, feel free to share them in the comments. Let’s keep learning and growing together! 🚀