DAY6:File Permissions and Access Control Lists

DAY6:File Permissions and Access Control Lists

File Permissions:

Absolute(Numeric mode):

  • "chown" is used to change the ownership permission of a file or directory.

  • "chgrp" is used to change the group permission of a file or directory.

  • chmod is used to change file permissions

Before permission change:

Created folder devopsbatch3:

check permissions for user/group/others

After permissions change:

Symbolic Mode :

+

Adds a permission to a file or directory

Removes the permission

=

Sets the permission and overrides the permissions set earlier.

ACL(Access Control List):

Access control list (ACL) provides an additional, more flexible permission mechanism for file systems. It is designed to assist with UNIX file permissions. ACL allows you to give permissions for any user or group to any disc resource.

Think of a scenario in which a particular user is not a member of group created by you but still you want to give some read or write access, how can you do it without making user a member of group, here comes in picture Access Control Lists, ACL helps us to do this trick.

Basically, ACLs are used to make a flexible permission mechanism in Linux.

List of commands for setting up ACL :

List of commands for setting up ACL :

  1. To add permission for user setfacl -m "u:user:permissions" /path/to/file

  2. To add permissions for a group setfacl -m "g:group:permissions" /path/to/file

  3. To allow all files or directories to inherit ACL entries from the directory it is within setfacl -dm "entry" /path/to/dir

  4. To remove a specific entry setfacl -x "entry" /path/to/file

  5. To remove all entries setfacl -b path/to/file

getfacl testfile.txt----To check permissions of file.

setfacl testfile.txt---To change permissions of file.

Thank you for reading!! Hope you find this helpful.

#day06challenge#90daysofdevops

Always open for suggestions..!!

Thankyou Shubham Londhe !!