---
# System prepended metadata

title: Basic Linux ACL(Access Control List)

---

# Basic Linux ACL(Access Control List)

## Install (Ubunutu/Debian Based)
```bash=
sudo apt-get install acl
```
**Note** : ```facl``` should come by default with the **OS**, if not install by running the above.

## Getting Information
```bash=
getfacl /path/to/file
```
## Example : 
* Run ```getfacl go.mod```
* Output : 
```
# file: go.mod // Filename
# owner: a // Owner
# group: a // Group
user::rw- // user can read and write
group::rw- // group can read and write
other::r-- // others can read only
```

## Changing File Permission

### User
```
setfacl -m "u:user:permissions" /path/to/file
```
## Example : 
* Run ```setfacl -m u:a:rwx go.mod```
* Run ```getfacl go.mod```
* Output : 
```
# file: go.mod
# owner: a
# group: a
user::rw-
user:a:rwx // new changed -> user can read,write and execute.
group::rw-
mask::rwx
other::r--
```

### Group
```
setfacl -m "g:group:permissions" /path/to/file 
```

### Inherit From It's Directory
```
setfacl -dm "entry" /path/to/dir
```

### Removing/Reversing ACL
```
setfacl -b /path/to/file
```
* Run ```setfacl -b go.mod```
* Run ```getfacl go.mod```
* Output : 
```
# file: go.mod // Filename
# owner: a // Owner
# group: a // Group
user::rw- // user can read and write
group::rw- // group can read and write
other::r-- // others can read only
```

## Reference
1. Made notes Following [this](https://www.geeksforgeeks.org/access-control-listsacl-linux/) link, check for more.
2. [Beyond Permissions: Linux ACLs
](https://serversforhackers.com/c/beyond-permissions-linux-acls)
3. [POSIX ACLs in Linux](https://www.theurbanpenguin.com/posix-acls-in-linux/)
4. [Access Control Lists on Linux Explained](https://devconnected.com/access-control-lists-on-linux-explained/)
5. [Linux ACLs](https://serversforhackers.com/c/linux-acls)
6. [Setting Up ACL](https://www.learnitguide.net/2015/12/setting-access-control-lists-on-linux.html)