File Permissions in Linux – Read/Write/Execute

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

File permissions, ownerships control the access level of files and system process specific to users. This makes sure that the authorized users and process can only access the specific files and directories.

In this guide you are going to learn how to assign permission access rights to different classes of users.

File Permission Basics

The file permissions are applied over three different types of users.

  1. Owner
  2. Group
  3. Others (Everyone else)

The permissions can be assigned to the above users using the chmod command. You can assign three types of permissions with any combinations which are read, write and execute.

To check the permission of a file you can use the ls command.

ls -l filename.txt
-rw-rw-r-- 1 user group 3793218 Sep 11 17:57 filename.txt

ls -l directory
drwxr-xr-x 5 user group 4096 Sep 15 05:18 sub-directory


  • r read
  • w write
  • x execute


Red: Determines the type if file -, if directory d, symbolic link l.

Orange: Determines the permissions for Owner.

Green: Determines the permissions for Group.

Blue: Determines the permissions for Others.

Numeric Method

Each operations read, write, execute has their own numbers.

  • r read = 4
  • w write = 2
  • x execute = 1
  • no permission = 0

For example, to give read, write and execute permission to the file’s owner, read and execute permissions to the file’s group and only read permissions to all other users, you would do the following:

Owner: rwx = 4+2+1 = 7
Group: r-x = 4+0+1 = 5
Others: r-x = 4+0+0 = 4

Using the method above, we come up to the number 754, which represents the desired permissions.

NumberPermission TypeSymbol
0No Permission
3Execute + Write-wx
5Read + Executer-x
6Read +Writerw-
7Read + Write +Executerwx

To set up the setuidsetgid, and sticky bit flags, you can use four digits number.

When the 4 digits number is used, the first digit has the following meaning:

  • setuid = 4
  • setgid = 2
  • sticky = 1
  • no changes = 0

The next three digits have the same meaning as when you are using the 3 digits number.

If the first digit is 0 it can be omitted, and the mode can be represented with 3 digits. The numeric mode 0754 is the same as 754.

You can check the file’s permissions in the numeric notation using the stat command.

stat -c '%a' filename.txt


Chmod Command

Here are some examples of how to use the chmod command in numeric mode:

Give the file’s owner read and write permissions and only read permissions to group members and all other users:

chmod 644 directory

Give the file’s owner read, write and execute permissions, read and execute permissions to group members and no permissions to all other users:

chmod 750 directory

Give read, write, and execute permissions, and a sticky bit to a given directory:

chmod 1777 directory

Recursively set read, write, and execute permissions to the file owner and no permissions for all other users on a given directory:

chmod -R 700 directory


Now you have understood how to assign permissions in Linux based systems..

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.