Linux File Permissions - A Key to System Security and Management
Linux file permissions is essential for anyone who works as a devops engineer and manage a Linux system. Each file and directory has permissions that direct who can read, write, or execute them, represented by a string like -rwxr-xr--.
Let’s understand the Permissions String:
File Type: The first character shows the type of file. A dash - is a regular file, while d is a directory.
Owner Permissions: The next three characters show the owner's permissions. rwx means read (r), write (w), and execute (x).
Group Permissions: The following three characters are for the group's permissions.
Others Permissions: The last three characters indicate permissions for all other users.
Numerical Representation:
4 = read (r)
2 = write (w)
1 = execute (x)
Combine these to set permissions. for example, 755 means:
-Owner: rwx (4+2+1=7)
-Group: r-x (4+1=5)
-Others: r-x (4+1=5)
Changing Permissions with ‘chmod’ To set file permissions, use the chmod command.
e.g. ‘chmod’ 755 <-filename-> sets the permissions to rwxr-xr-x.
Key Takeaways:
-Read (r) - View file contents.
-Write (w) - Modify file contents.
-Execute (x) - Run the file as a program.
Subscribe to my newsletter
Read articles from Mohd Shadan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Mohd Shadan
Mohd Shadan
DevOps & Clouds Enthusiast | AWS | Azure | DevOps | Linux| Windows | Python | Shell Scripting Learning technologies....