๐ Access Control Lists (ACLs) in ๐ง Linux: Managing File Permissions

๐ Quick Intro ๐ฅ
Access control list (ACL) provides an additional, more flexible permission mechanism for file systems.
Using ACL we can give file or directory permissions to particular user or group
Think of a scenario, In a library certain rooms are for specific groups. But, if you want to give a friend access to a room without them joining the group, think of Access Control Lists (ACLs) as a special hidden key. With ACLs, you can grant access to that room without making your friend an official member of the group. It's like a secret pass that allows specific access without changing the group setup.
๐ Let's Start โ
Check ACL permission โ
getfacl <file/dir>
The permissions that you can see above are default permissions not specific to ACL permissions
Set ACL permission for User ๐จ
setfacl -m "u:<user>:<permissions>" <file/dir>
If you do
ls -lafter setting ACL permissions, you can see+at the end of file permissions, which represents ACL permissions that have been added to that file/dir.You can use
-dalong with-mto allow all files or directories to inherit ACL entries from the directory it is withinSet ACL permission for Group ๐ฅ
setfacl -m "g:<group>:<permissions>" <file/dir>
You can use
-dalong with-mto allow all files or directories to inherit ACL entries from the directory it is withinRemove specific User ACL permission ๐คโ
setfacl -x "u:<user>" <file/dir>
The
user:user1:-wxhas been removedRemove specific Group ACL permision๐ฅโ
setfacl -x "g:<group>" <file/dir>
The
group:user1:rwxhas been removedRemove all ACL permissions ๐๏ธ
setfacl -b <file/dir>
Removed all ACL permissions
๐ Conclusion ๐
You just learned ACL ๐
Happy Learning!!! ๐




