Day6-File Permissions and Access Control Lists

Day6-File Permissions and Access Control Lists

Linux, allows multiple users to work on the same server simultaneously without disrupting each other.

Linux File Ownership

Every file and directory on the Linux system is assigned 3 types of owner: user, group and other.

Linux File Permissions

Every file and directory in the Linux system has three permissions that are read, write and execute for three owners(user, group and other).

*To see the permission of a file or directory we use the command ls -ltr

* To change the Permission of a file or directory we use chmod <permisson type> <file name>

Let's understand the above image:

the first ‘‘ shows that we have selected a file

-rwxrwxrwx

if there is a 'd' it determines that it is a directory

for example drwxrwxrwx

*In case we want to change the group owner only, the command is

chgrp group_name filename

For a better understanding please go through the below image :

ACL :

ACL means Access Control List. ACL allows us to give permissions for any user or group to any disc resource.

Note: chmod is use to give the permission on files or folders where ACL give permission on a file more than one group or users from diffrent groups and we can customise the permissions type.

The getfacl command is used to display the current ACL settings for a file or directory, while the The setfacl command is used to add or modify an ACL.

getfacl :

setfacl :

To add permissions for a user (user is either the user name or ID):

# setfacl -m "u:user:permissions"

To add permissions for a group (group is either the group name or ID):

# setfacl -m "g:group:permissions"

To allow all files or directories to inherit ACL entries from the directory it is within:

# setfacl -dm "entry"