Linux file permissions

File permissions are stored together with the data on a disk. The Linux kernel uses them to decide which users and processes can access what file.

This page can be considered as a good cheat sheet, while the underlying articles explain how to use this information.

Main permissions

  • Read (r): Allows users to view the contents of a file or directory
  • Write (w): Grants users the ability to modify the contents of a file or directory
  • Execute (x): Enables users to execute a file or access the contents of a directory
PermissionAbbreviationOctal value
Readr4
Writew2
Executex1

Possible combinations:

PermissionsOctal Value
---0
--x1
-w-2
-wx3
r--4
r-x5
rw-6
rwx7

Entities

  • User (u): The user who owns the file or directory, or the owner of the file
  • Group (g): A collection of users who share common permissions
  • Others (o): Everyone else who is not the owner or a member of the group

How to change file permissions

Learn how to change the file permissions of files and directories on a Linux system. Follow the examples and make your system more secure.

Summary

Changing file permissions: chmod The primary command to change file permissions on a Linux system is chmod. It’s a basic system administration utility and pre-installed on the system. To make changes to an existing directory or file, it is first good to look up the existing permissions. This can be done using the ls -l command, that lists them with the long format. ls -l /etc/hosts -rw-r--r-- 1 root root 241 Feb 2 19:10 /etc/hosts There are two syntax styles to tell chmod what the new value should be.

Full article…

Introduction in Linux file permissions

Learn the basics of how a Linux system applies file permissions. We look into examples, to demystify what the file permissions mean and how to troubleshoot common issues.

Summary

Every file that is stored has a set of file permissions stored within the filesystem. This data about the actual data, it called meta-data. Let have a look at how file permissions work on Linux systems and how to read and understand them. Read, Write, and Execute Linux file permissions are divided into three main categories: Read (r): Allows users to view the contents of a file or directory Write (w): Grants users the ability to modify the contents of a file or directory Execute (x): Enables users to execute a file or access the contents of a directory User, Group, and Others These permissions are each assigned to three entities:

Full article…

Relevant linux file permissions commands

Like to learn more about the commands used in this section? Have a look at the cheat sheets or the related command page.

  • chmod
  • ls