# Linux File Permissions

1. Open the terminal, navigate to the desired directory
    
2. Create an empty file using the **touch** command
    
3. Confirm the creation with **ls -l**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707394220413/bffa06ba-0f55-4f81-9636-5f2810f091c4.png align="left")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707394304095/ef5f7fb6-3ce8-4f62-96b5-c4e8fa36d211.png align="left")

A hyphen denotes a regular file, while a "d" signifies a directory.

File or directory permissions are managed via commands :

***chmod, chown, and chgrp***

**Chmod : It allows** users to modify file permissions. It modify read, write, and execute permissions for the owner, group, and others, enhancing security and control over file access.

It can be represented by symbolic or numeric expressions

Symbolic representation: chmod u+rx,g-rwx,o+w \[file.txt\]

Numeric representation: chmod 777 \[file.txt\]

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707394672264/e442acb0-a930-4a11-a191-71783c943485.png align="left")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707394752248/1406abc0-439d-4f31-9e91-e2f3cc51f5b5.png align="left")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707394834878/937616c6-ff20-4caf-812b-d2ebe3ee3e66.png align="left")

**Chown :** The chown command in Linux is used to change the ownership of files and directories.

Syntax is chown \[new\_owner\]:\[new\_group\] file

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707395248205/22562d2b-ff6c-469a-82a2-b19d79bf091e.png align="left")

Initially, the file "demo2.txt" was owned by the user "ubuntu" and belonged to the group with the same name. After executing the chown command, the ownership successfully changed the to "user1"

**Chgrp :** The chgrp command in Linux is used to change the group ownership of a file or directory. This command allows users to modify the association of a file or directory with a specific group.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707395409781/dfc6ea2b-d47a-4a97-8ba4-7bdc6a0ea195.png align="left")

ACL (Access Control List) :

It offers advanced permissions beyond the standard owner, group, and others model.

'getfacl' to view ACL entries for a file or directory, revealing detailed user-specific permissions.

'setfacl' to modify ACLs, granting or revoking permissions for users or groups.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707395616496/7b24ca2f-a983-4cc6-8aef-ca40630370d4.png align="left")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707395645862/9e182e0c-7c7b-4ca5-ba9e-dadd6724e977.png align="left")

setfacl -m u:user1:rwx allows user "user1" read write and execute access.

Provides granularity enhances access control .
