#90daysofdevops { Day -6}
Day 6: Understanding Linux File Permissions and Access Control Lists (ACL)
Greetings, fellow tech enthusiasts! π Today, in the "WHAT THE HECK IS DEOPS?" series we embark on a thrilling journey into the heart of Linux as we unravel the mysteries of File Permissions and Access Control Lists (ACLs). ππ»
To kick things off, let's create a simple file and unravel its secrets using the ls -ltr
command. ππ
bashCopy codetouch my_file.txt
ls -ltr
Behold the details, as time travels in reverse, unveiling the birth of our file! β³π
Understanding the Three Guardians:
In the vast Linux universe, file permissions are guarded by three categories of users:
Owner π β The sovereign ruler of the file or application.
chown
ππ β The command to change the ownership permission.
Group π₯ β The trusted alliance that owns the file or application.
chgrp
π₯π β The command to change the group permission.
Others π β All users with access to the system, outside the owner and group.
chmod
ππ β The command to change other users' permissions.
Task Time:
As a thrilling task, let's alter the user permissions of our file and witness the metamorphosis using ls -ltr
!
bashCopy codechmod u+rwx my_file.txt
ls -ltr
Feel the power as you grant or revoke permissions with the command line! ππ
Crafting the Article:
In the enchanting land of Linux, understanding file permissions is like holding the keys to a digital fortress. Each user category, owner, group, and others, plays a crucial role in securing our digital assets. π‘οΈπ
Changing ownership with chown
, adjusting group permissions with chgrp
, and manipulating others' access with chmod
are the spells every Linux sorcerer must master. π¨βπβ¨
Now, let's delve into the mystical world of Access Control Lists (ACLs). π§ββοΈβ¨
ACL Magic:
ACLs provide an extra layer of control over files and directories. The spells getfacl
and setfacl
allow us to gaze into and alter these magical lists.
bashCopy codegetfacl my_file.txt
setfacl -m u:username:rw my_file.txt
Unlock the secrets of extended permissions and command your files with precision! ππ
In the mesmerizing realm of Linux, file permissions dance to the rhythm of three enchanting actions: read π, write π, and execute πββοΈ. These permissions, woven into the fabric of the system, bestow magical powers upon different categories of users: owner (u) π, group (g) π₯, and others (o) π. Let's decode the mystical meanings of these permissions:
Read (r) π:
File: Users with "read" permission can peer into the secrets of a file using commands like
cat
or by opening it in a text editor.Directory: "Read" permission on a directory allows users to explore its treasures.
Write (w) π:
File: Users with "write" permission can inscribe, edit, or erase the contents of a file.
Directory: "Write" permission on a directory empowers users to create, obliterate, or mold files within.
Execute (x) πββοΈ:
File: For files, "execute" permission invites users to perform the file's programmed dance or script.
Directory: "Execute" permission on a directory is the key to unlock and traverse its mystical realms.
To wield the magic wand of permission changes in Linux, we invoke the chmod
command. The basic incantation is as follows:
bashCopy codechmod permissions file_or_directory
Here, "permissions" can be expressed in different dialects:
Symbolic Representation: Weaves letters (u, g, o) with symbols (+, -, =) to add, subtract, or set permissions. For example:
bashCopy codechmod u+rwx file.txt # Adds read, write, and execute permissions for the owner chmod go-w file.txt # Removes write permission for the group and others chmod a=r file.txt # Sets read-only permission for all (owner, group, and others)
Numeric Representation: Unfurls permissions in numerical dance moves. Each digit corresponds to a user category (owner, group, others), crafting a harmonious permission combination. For example:
bashCopy codechmod 744 file.txt # Grants read, write, and execute to the owner, and read-only to group and others chmod 644 file.txt # Bestows read and write to the owner, and read-only to group and others
With the spell of chmod
, administrators orchestrate the symphony of access control, ensuring the security and grace of files and directories in the Linux kingdom. πΆπ
Connect with me on LinkedInππ:https://www.linkedin.com/in/nikhil-kathale-27544a1b5/
Subscribe to my newsletter
Read articles from Nikhil Kathale directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by