Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk6 min

Understanding Linux File Permissions with chmod: A Beginner’s Guide

A beginner's guide to Linux file permissions with chmod: how owner, group, and other bits work, how to read numeric and symbolic modes, and how to change permissions safely.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To change a file’s permissions in Linux, run chmod with either a numeric mode such as chmod 644 notes.txt or a symbolic change such as chmod u+x script.sh. Before you do, you need to understand what the permission string means, because a wrong mode can lock you out of your own files or expose them to other users. This guide explains the model, shows how to read and write both mode styles, and gives a safe routine for making changes.

How Linux permissions are organized

Every file and directory carries three sets of permission bits, one for each class of user:

As an Amazon Associate I earn from qualifying purchases.

  • Owner (u): the user who owns the file.
  • Group (g): the users who belong to the file’s group.
  • Other (o): everyone else on the system.

Each class can hold three bits: read (r), write (w), and execute (x). The meaning of each bit depends on whether the object is a file or a directory, and this is where most beginner confusion starts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the bits mean for files

  • Read lets you read the file’s contents.
  • Write lets you change the file’s contents.
  • Execute lets you run the file as a program. A script without execute permission cannot be started directly, even if its text is perfectly valid.

What the bits mean for directories

  • Read lets you list the names inside the directory.
  • Write lets you create and remove entries in the directory.
  • Execute does not mean “run.” On a directory it means search, or traverse: you can pass through it as part of a path and access entries whose names you already know. A directory with read but no execute lets you see names you cannot actually open.

The GNU Coreutils manual describes these directory meanings explicitly, and they are the reason a directory with r but without x is a confusing state to encounter.

Reading a permission string

Running ls -l prints a line like this:

-rw-r--r-- 1 alice staff 2048 Oct  9 10:14 notes.txt

The first character is the file type: - for a regular file, d for a directory, and l for a symbolic link. The next nine characters are three triplets, read left to right as owner, group, and other. In -rw-r--r--, the owner can read and write, while the group and everyone else can only read.

For an exact view, stat prints the mode explicitly. On GNU systems, this command shows the octal value, the symbolic form, and the name in one line:

stat -c '%a %A %n' notes.txt

The output would look like 644 -rw-r--r-- notes.txt. The -c option with a format string is specific to GNU stat; BSD and macOS versions use different flags.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Numeric modes

Numeric modes use octal digits. Each permission has a value: read is 4, write is 2, and execute (or search, for directories) is 1. For each class, add the values of the bits you want. The three digits are owner, group, and other, in that order.

Digit Bits Meaning
7 rwx 4 + 2 + 1, read, write, and execute
6 rw- 4 + 2, read and write
5 r-x 4 + 1, read and execute
4 r– 4, read only
0 — No access

Some common modes and what they produce:

Command Resulting string Typical use
chmod 644 notes.txt rw-r--r-- Ordinary documents readable by everyone
chmod 755 script.sh rwxr-xr-x Scripts and programs others can run
chmod 600 private.txt rw------- Files only the owner should read, such as private keys

A numeric mode sets all nine bits at once. It does not keep whatever bits were there before, so chmod 644 on a file that was rwxrwxrwx leaves it at rw-r--r--. This is what makes numeric modes predictable, and also what makes them risky when you only meant to change one thing.

The numeric form can also take a fourth, leading digit for special bits: set-user-ID is 4, set-group-ID is 2, and the sticky bit is 1. These bits change how a program or directory behaves, not just who can read it. Leave them alone until you know you need them.

Symbolic modes

Symbolic modes read like a sentence: a class, an operator, and the permissions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Classes: u (owner), g (group), o (other), or a (all three).
  • Operators: + adds permissions, - removes them, and = sets exactly the listed permissions for those classes.
  • Permissions: r, w, and x.

Examples:

  • chmod u+x script.sh adds execute permission for the owner and leaves everything else alone.
  • chmod go-w file.txt removes write permission from the group and other.
  • chmod a=r file.txt makes the file read-only for all three classes, removing write and execute from everyone.

Symbolic modes suit small edits to an existing setup. If you omit the class letter, as in chmod +x script.sh, the process umask decides which classes are affected, so write u+x, a+x, or another explicit class when the result matters.

A safe routine for changing permissions

Work through these steps for any file where the change matters:

  1. Inspect the current mode. Run ls -l filename or the stat command above.
  2. Decide who needs which access. Write the required access for owner, group, and other before typing anything.
  3. Apply the narrowest change. Prefer u+x over 755 when you only need to make a script runnable by you.
  4. Inspect again. Confirm the string matches what you intended. Run the program or open the file to test it.

Ownership and privilege

Only the file’s owner or a process with suitable privilege (such as root) can change its mode bits. If chmod returns Operation not permitted, you are not the owner, so check with ls -l and use sudo only if the change is actually intended for a system file.

Making a script executable

A script needs execute permission before you can start it directly. Add it for yourself, then run it by path:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
chmod u+x backup.sh
./backup.sh

If you want everyone on the system to run it, use chmod a+x backup.sh, but only when the script is safe for every user to execute. If the shell reports Permission denied even after chmod succeeds, check that the filesystem was not mounted with the noexec option, which blocks running programs regardless of mode bits.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Recursive changes and symbolic links

chmod -R applies a change to a directory and everything beneath it. Use it only when every file in that tree should receive the same change. A recursive chmod 644 on a project directory, for example, will also strip execute permission from its subdirectories and any scripts inside, which breaks the directory’s traversal.

Symbolic links need separate attention. On Linux, the permissions of a symbolic link itself are not meaningful: the system ignores them, and chmod acts on the file the link points to when you name the link directly. During a recursive run, GNU chmod ignores symbolic links it encounters by default. Following links during recursive operations can expose files outside the tree you meant to change, which is why the GNU manual warns about it.

Common mistakes

  • Using chmod 777 as a fix. It gives read, write, and execute to owner, group, and other. Using it to get past an error hides the real cause and makes the file writable by any user. Determine which class needs which access instead.
  • Confusing directory execute with running. A directory with x lets you traverse it, not run anything inside it. A directory with r and no x lets you see names you cannot open.
  • Assuming permissions explain every failure. Access can also be blocked by ownership, mount options such as noexec, filesystem attributes, or system policy. If the mode looks correct and access still fails, check those next.
  • Treating special bits as defaults. Setuid, setgid, and the sticky bit have specific security effects. Do not add them to fix a permission error.

Choosing between numeric and symbolic modes

Use numeric modes when you know the complete pattern you want, such as 600 for a private file. Use symbolic modes when you want to change one aspect of an existing mode, such as adding execute for yourself with u+x, and leave the rest untouched. Symbolic modes are less likely to remove access you did not mean to remove.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Sources

The behavior described here follows the GNU Coreutils manual’s chmod invocation documentation, which states that chmod “changes the access permissions of the named files.” Specific flags for stat and recursive behavior vary between GNU, BSD, and macOS tools, so check your system’s man chmod and man stat pages when you work on a different platform.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.