•  Home
  •  Dashboard
  •  Company
    • About Us
    • Blog
    • Careers
    • Contact Us
    • Data Centers
    • Looking Glass
    • Network
    • Reseller
  •  Hosting Services
    • Infrastructure
      • iColocation
    • Compute
      • cMetal
      • cVirtual
    • Storage
      • sObject
      • sBlock
    • Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • Protection
      • pBackup
      • pDDoS
  •  Solutions
    • Ecommerce
    • Finance
    • Gaming
    • Hosting
    • Management
    • Security
    • System Integrator
  •  Support
    • Community
    • Knowledge Base
    • Open A Ticket
  •  USA & Canada: 800-933-1517
  •  International: 626-549-2801
  •  Email: sales@psychz.net
  • Services
    • new-colocation-header-img
      Infrastructure
      • iColocation
    • new-compute-header-img
      Compute
      • cMetal
      • cVirtual
    • new-storage-header-img
      Storage
      • sObject
      • sBlock
    • new-networking-header-img
      Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • new-protection-header-img
      Protection
      • pBackup
      • pDDoS
  • Solutions
    • Ecommerce
    • Security
    • Gaming
    • Hosting
    • Management
    • Finance
    • System Integrator
  • Dashboard

Linux File Permissions Cheat Sheet

  • Home
  • Client
  • Knowledgebase
  • Linux
  • Linux File Permissions Cheat Sheet

Table Of Content

Related Articles

  • How to generate SSH Keys on Linux?
  • The ELK Stack: Elasticsearch, Logstash, Kibana.
  • How to install Node.js on AlmaLinux 8
  • Firewalld commands for CentOS 7 and CentOS 8
  • Managing systemd services and units using systemctl commands
  • How to check RAM for error using Ubuntu Live CD?
  • How to remotely connect to a Linux machine using a smartphone?
  • Unable to Access The Server Via SSH
  • How to clone and migrate a Linux hard drive to another server?
  • SCP Command Syntax Examples in Linux
  • Whitelisting Edge Server IPs
  • traceroute in Linux
  • Ubuntu remove mysql
  • ssh host key verification failed error
  • logrotate
  • How to rsync two directories
  • setup hourly crontab
  • Views: (8688)
  • Votes: (-3)
Was this article helpful?
VOTE

Linux File Permissions Cheat Sheet

Publisher: Psychz Networks,  November 29,2021

  • Introduction
  • About File Permissions
  • Notations to change permissions
  • Chmod
  • Changing file ownership
  • Changing group ownership

Introduction

Linux systems are not only multitasking but also multi-user. It means that more than one user can be operating the computer at the same time. If the system is attached to a network, or the Internet, remote users can log in via ssh (secure shell) and operate the computer. In fact, remote users can execute graphical applications and have the output displayed on a remote computer.

On a Linux system, each file and directory is assigned access rights for the owner of the file, the members of a group of related users, and everybody else. Rights can be assigned to read a file, to write a file, and to execute a file (i.e., run the file as a program).

Permissions

Permissions on Linux systems are split into three classes:

User
Group
Other

Files and directories are owned by a user. Files and directories are also assigned to a group. If a user is not the owner, nor a member of the group, then they are classified as other.

Changing permissions

In order to change permissions, we need to first understand the two notations of permissions.

Symbolic notation
Octal notation

Symbolic notation

It is what you'd see on the left-hand side if you ran a command like ls -l in a terminal. The first character in symbolic notation indicates the file type and isn't related to permissions in any way. The remaining characters are in sets of three, each representing a class of permissions.

The first class is the user class. The second class is the group class. The third class is the other class. Each of the three characters for a class represents the read, write and execute permissions.

Read (r) : The read permission allows you to open and read the content of a file. But you can't do any editing or modification in the file.
Write (w) : The write permission allows you to edit, remove or rename a file. For instance, if a file is present in a directory, and write permission is set on the file but not on the directory, then you can edit the content of the file but can't remove, or rename it.
Execute (x): In Unix type system, you can't run or execute a program unless execute permission is set.But in Windows, there is no such permission available.

Permission On a File On a directory
r (read) read file content (cat) read directory content (ls)
w (write) change file content (vi) create file in directory (touch)
x (execute) execute the file enter the directory (cd)

-rwxr--r--: A regular file whose user class has read/write/execute, group class has only read permissions, other class has only read permissions
drw-rw-r--: A directory whose user class has read/write permissions, group class has read/write permissions, other class has only read permissions
crwxrw-r--: A character special file whose user has read/write/execute permissions, group class has read/write permissions, other class has only read permissions

Octal notation

Octal (base-8) notation consists of at least 3 digits (sometimes 4, the left-most digit, which represents the setuid bit, the setgid bit, and the sticky bit).

Each of the three right-most digits are the sum of its component bits in the binary numeral system.

For example:

The read bit (r in symbolic notation) adds 4 to its total
The write bit (w in symbolic notation) adds 2 to its total
The execute bit (x in symbolic notation) adds 1 to its total

So what number would you use if you wanted to set a permission to read and write? 4 + 2 = 6.

Let us now see how to change the permissions to file or directory using example of both Symbolic and Octal notations

Chmod

The chmod command is used to change the permissions of a file or directory. To use it, we specify the desired permission settings and the file or files that we wish to modify.

It is easy to think of the permission settings as a series of bits (which is how the computer thinks about them). Here's how it works:

rwx rwx rwx = 111 111 111
rw- rw- rw- = 110 110 110
rwx --- --- = 111 000 000

Where

rwx = 111 in binary = 7
rw- = 110 in binary = 6
r-x = 101 in binary = 5
r-- = 100 in binary = 4

Now, if we represent each of the three sets of permissions (owner, group, and other) as a single digit, we have a pretty convenient way of expressing the possible permissions settings. For example, if we wanted to set 'dummy_file' to have read and write permission for the owner, but wanted to keep the file private from others, here's how we would do it

# chmod 600 dummy_file

Here is a table of numbers that covers all the common settings. The ones beginning with "7" are used with programs (since they enable execution) and the rest are for other kinds of files.

Value Meaning
777 (rwxrwxrwx) No restrictions on permissions. Anybody may list files, create new files in the directory and delete files in the directory. Generally not a good setting.
755 (rwxr-xr-x) The directory owner has full access. All others may list the directory, but cannot create files nor delete them. This setting is common for directories that you wish to share with other users.
700 (rwx------) The directory owner has full access. Nobody else has any rights. This setting is useful for directories that only the owner may use and must be kept private from others.
666 (rw-rw-rw-) All users may read and write the file.
644 (rw-r--r--) The owner may read and write a file, while all others may only read the file. A common setting for data files that everybody may read, but only the owner may change.
600 (rw-------) The owner may read and write a file. All others have no rights. A common setting for data files that the owner wants to keep private.

Changing File Ownership

We can change the owner of a file by using the chown command. Here's an example: Suppose we wanted to change the owner of a 'dummy_file' from "me" to "new_user"

# sudo chown new_user dummy_file

Note: In order to change the owner of a file, you must be root user or have sudo privileges.

chown works the same way on directories as it does on files.

Changing Group Ownership

The group ownership of a file or directory may be changed with chgrp. This command is used like this:

# chgrp new_group dummy_file

In the example above, we changed the group ownership of dummy_file from its previous group to "new_group". We must be the owner of the file or directory to perform a chgrp.

Conclusion

In the above article we have learned three user types in linux viz. User, Group, and other. We have also learned that linux divides the file permissions into Read (r), write (w), and execute (x). How to change file permissions on a file using 'chmod' command using Symbolic and Octal notation.

We hope that you find this article useful and put the information to use. If you like this article, please show your appreciation by clicking on vote button with 'Yes' located on your left hand side.

Related Articles

  • How to generate SSH Keys on Linux?
  • The ELK Stack: Elasticsearch, Logstash, Kibana.
  • How to install Node.js on AlmaLinux 8
  • Firewalld commands for CentOS 7 and CentOS 8
  • Managing systemd services and units using systemctl commands
  • How to check RAM for error using Ubuntu Live CD?
  • How to remotely connect to a Linux machine using a smartphone?
  • Unable to Access The Server Via SSH
  • How to clone and migrate a Linux hard drive to another server?
  • SCP Command Syntax Examples in Linux
  • Whitelisting Edge Server IPs
  • traceroute in Linux
  • Ubuntu remove mysql
  • ssh host key verification failed error
  • logrotate
  • How to rsync two directories
  • setup hourly crontab
  • Views: (8688)
  • Votes: (-3)
Was this article helpful?
VOTE
Copyright © 2025 Psychz Networks,
A Profuse Solutions Inc Company
Hosting Services
Infrastructure
  • iColocation
Compute
  • cMetal
  • cVirtual
Storage
  • sObject
  • sBlock
Networking
  • nCDN
  • nIP Transit
  • nWavelength
Protection
  • pBackup
  • pDDoS
Company
  • About Us
  • Blog
  • Careers
  • Contact Us
  • Data Centers
  • Looking Glass
  • Network
  • Reseller
Policies
  • Acceptable Usage Policy
  • Privacy Policy
  • Service Level Agreement
  • Terms and Conditions
Support
  • Community
  • Knowledge Base
  • Open A Ticket
Get In Touch
  • Psychz Networks,
    A Profuse Solutions Company
    611 Wilshire Blvd #300
    Los Angeles,California 90017
    USA
  • US/Canada: 800-933-1517
  • International: 626-549-2801