File Permissions and Access Control Lists

File Permissions and Access Control Lists

#90 Days of DevOps Challenge - Day 6

File permissions are core to the security model used by Linux systems. They determine who can access files and directories on a system and how

There are three types of File Permissions in Linux:

  • Basic Permission

  • Special Permission

  • Access Control Lists(ACL)Permissions.

File Permissions:-

If we need to check the file permissions then need to use the below command

Command:- ls -la

Permission Description

Learning the shell - Lesson 9: Permissions

How to check if it's a Directory or File?

Chmod

The "chmod" command is used to change the permissions of a file or directory.

Command:- chmod <permissions> <file_name>

Ex:- chmod 755 file3.txt

Chown

The "chown" command is used to change the ownership of a file or directory.

Command:- chown <new_owner_name> <file_name>

Ex:- chown saikat file3.txt

Chgrp

The "chgrp" command is used to change the group ownership of a file or directory.

Command:- chgrp <new_group_name> <file_name>

Ex:- chgrp saikat file3.txt

Access Control List (ACL)

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.

Use of ACL :
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.

From Linux man pages, ACLs are used to define more fine-grained discretionary access rights for files and directories.

To install ACL, the following commands are used:-

sudo apt-get install acl

getfacl

It is used to display the current ACLs for a file or directory.

Command:- getfacl <filename>

setfacl

It is used to set the ACLs for a file or directory.

Command:- setfacl -m "u:user:permissions" /path/to/file

Devops#devops,#90daysofDevOps

Thank you for reading!! I hope you find this article helpful!!

if any query or if any correction to be done in this blog please let me know.

Happy Learning!!

Saikat Mukherjee

Did you find this article valuable?

Support Saikat Mukherjee's blog by becoming a sponsor. Any amount is appreciated!