File Permissions and Access Control Lists
Day 6 Task: Read, write, execute File permissions.

Hello all, I'm Deepika Pinjarla! I'm a passionate Devops Engineer. I like sharing my knowledge and insights through my writing, and I'm here at Hash node. On my blog, you'll find articles covering a wide range of topics related to DevOps. My goal is to provide valuable content that helps learners in their journey. Join me on this learning adventure as we explore the wonderful world of DevOps together!
Feel Free to provide your valuable feedbacks or suggestions for the blogs, if any corrections need to update, please inform me in the comments. Thanks in Advance! Have fun while learning:)
Task 1: Create a simple file and do ls -ltr and change the user permissions of the file and note the changes after ls -ltr
Let's begin with creating a file, creating a filename book1.txt
Here we can learn how to change the permissions of the owner, group, and others
chown is used to change the ownership permission of a file or directory.
Syntax: chown<user_name><filename.txt>
chgrp is used to change the group permission of a file or directory.
Syntax: chgrp<group_name><filename.txt>
chmod is used to change the other user's permissions of a file or directory.
read(r)= 4
write(w)=2
execute(x)=1

ls -ltr the ls will display the list of the files and ltr means l- long listing, t- time, r- recursive.
After executing ls -ltr you will get the output as below(_rw- r-- r--).The first hyphen it is a file, sometimes if it a directory it will display as 'd'. Then followed by rw- this means the user has read, write, -(hyphen) says no execute permissions to the user.
Next, it started with r-- this means the group has read permission only no write and execute permissions, same permissions to the other users as well in the above example.
To change the permissions of the users.
If I want to give read and write & execute permissions to the user means
Syntax: chmod 744 book1.txt

Task 2: write about ACL and try out the commands getfacl and setfacl commands.
ACL stands for Access Control List, you can set permissions for specific users or groups on a file or directory.
ACLs allow you to grant or deny individual users or groups specific permissions such as read, write, execute, delete, etc., independently of the standard owner-group-world permissions.
Syntax: getfacl Book_post.txt

The setfacl command is used to set access control lists (ACLs) on files and directories in Linux-based systems.
syntax: setfacl -m u:username:rw file.txt
By using the above command, it will grant read and write permissions to a specific user on a file.
Conclusion:
File Permissions play a key role in Linux, with the help of commands like chown, chgrp, chmod we can easily modify the changes at the desired place. The setfacl and getfacl commands are used to set ACL entries, modify existing ACLs, view ACLs associated with a file or directory, and more.
Have fun while Learning:)




