# Day 6 - 90DaysofDevops

### File Permissions and Access Control Lists

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686051388810/9a9feedb-8e91-4938-a1a7-3a8eece32cb8.png align="center")

**"chmod"** is the command to provide permission for file/directory.

**chmod &lt;permission\_value&gt; &lt;file\_name&gt;**

$ sudo chown kumar 23-06-06\_16-19-16.tgz

#changed the user permissions for 23-06-06\_16-19-16.tgz from bipul to kumar user

**Read, write, execute and –**

* The ‘**r**’ means you can “read” the file’s contents.
    
* The ‘**w**’ means you can “write”, or modify the file’s contents.
    
* The ‘**x**’ means you can “execute” the file. This permission is given only if the file is a program.
    
* If any of the “**rwx**” characters is replaced by a ‘**\-**‘, then that permission has been revoked.
    
* If the permission is given as **777** as per the below mode, then the user will have full access to the folder or file. This is not advisable if the user is not a root user.
    

<table><tbody><tr><td colspan="1" rowspan="1"><p>Symbolic</p></td><td colspan="1" rowspan="1"><p>Mode</p></td><td colspan="1" rowspan="1"><p>Absolute Mode</p></td></tr><tr><td colspan="1" rowspan="1"><p>r</p></td><td colspan="1" rowspan="1"><p>read</p></td><td colspan="1" rowspan="1"><p>4</p></td></tr><tr><td colspan="1" rowspan="1"><p>w</p></td><td colspan="1" rowspan="1"><p>write</p></td><td colspan="1" rowspan="1"><p>2</p></td></tr><tr><td colspan="1" rowspan="1"><p>x</p></td><td colspan="1" rowspan="1"><p>execute</p></td><td colspan="1" rowspan="1"><p>1</p></td></tr><tr><td colspan="1" rowspan="1"><p>(-)</p></td><td colspan="1" rowspan="1"><p>Null</p></td><td colspan="1" rowspan="1"><p>0</p></td></tr></tbody></table>

### **ACL**

ACL stands for Access Control Lists.

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 the user a member of the group, here comes in picture Access Control Lists, ACL helps us to do this trick.

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

sudo apt install acl

**getfacl** is the command to show what are permission assigned to any file/folder.

**setfacl** is the command used to grant permission to any file/folder.

**getfacl &lt;file or foldername&gt;**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686052666069/4000b12f-857a-4fe0-a4c3-6e3fc44032ae.png align="center")

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

**setfacl -m "g:group:permissions" /path/to/file**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686052929798/cf3cfa33-fa34-4a62-ac68-099b4a9a423e.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686053096307/474f96e5-35dc-4642-a88c-5aeb6ba39d9f.png align="center")
