The Linux chmod command controls who can read, write, or execute files and directories. Learn how permissions work for owners, groups, and other users, and see why careful access settings matter on shared systems. For ownership changes or renaming, Linux uses different commands.

Multiple Choice

What does the command 'chmod' do?

The command 'chmod' is used in Linux and Unix-like operating systems to change the permissions of a file or directory. Permissions determine who can read, write, or execute the file, which is crucial for system security and user access control. When 'chmod' is used, it modifies the permission settings for three categories of users: the owner of the file, the group associated with the file, and all other users. It allows specific permissions to be granted or revoked according to the needs of the system and its users. For instance, a user can use 'chmod' to allow others to read a file or to restrict write access to sensitive data. This makes it an essential tool for managing file security in a multi-user environment. Other options, such as changing file ownership or directory names, are managed by different commands (like 'chown' for ownership and 'mv' for renaming). The execution status is also not directly altered by 'chmod'; rather, the command sets permissions that can influence whether a file can be executed by users.

What Does chmod Do in Linux?

The chmod command changes file and directory permissions in Linux and other Unix-like systems. Those permissions control who can read, change, or run a file. That may sound like a small job, but it’s a key part of keeping a shared system orderly and secure.

Think of permissions as a set of keys. The owner might be allowed to edit a document, while other users can only read it. A program may be runnable by its owner but off-limits to everyone else. With chmod, an administrator or file owner can adjust those rules from the command line.

Three kinds of users, three kinds of access

Linux tracks permissions for three user categories:

  • User (u): the file’s owner

  • Group (g): users who belong to the file’s associated group

  • Others (o): everyone else on the system

Each category can have three basic permissions:

  • Read (r): view a file’s contents

  • Write (w): change or delete a file

  • Execute (x): run a program or, for a directory, access items inside it

A permission setting combines these categories and actions. For example, the owner of a script might have permission to read, edit, and run it, while other users can only read it. This lets people share resources without handing out more access than they need.

One detail catches many new Linux users off guard: permissions on a directory work a little differently from permissions on a regular file. Read permission lets a user list the directory’s contents. Write permission allows changes to its entries, such as adding or removing files. Execute permission lets a user enter the directory or access items within it. So a directory needs execute permission for users to reach files inside, even if they know the file names.

A closer look at the command

A common form of the command looks like this:


chmod MODE FILE

Here, MODE describes the permissions to set, and FILE is the file or directory to change. For instance:


chmod u+x script.sh

This adds execute permission for the file’s owner. It doesn’t change the file’s owner, rename it, or launch it. It changes the permission rule that affects whether the owner may run it.

You can check the current permissions with ls -l:


ls -l script.sh

A result might begin like this:


-rw-r--r-- 1 maya staff 245 Nov 26 09:30 script.sh

The first character shows the item type: a hyphen usually means a regular file, while d marks a directory. The next nine characters show permissions in three groups: owner, group, and others. In this example, the owner can read and write; the group and others can read. No one has execute permission.

Symbolic permissions: clear and readable

One way to use chmod is with symbolic notation. It uses letters for the user category and permission, plus a symbol for the change:

  • + adds a permission

  • - removes a permission

  • = sets the permissions to an exact combination

For example:


chmod g+w report.txt

This adds write permission for the file’s group. To remove it again:


chmod g-w report.txt

To set the owner’s permissions to read and write, with no execute permission:


chmod u=rw script.sh

Symbolic notation is handy when the desired change is narrow. You can adjust one category without rewriting the whole permission set. It also makes the command’s intent easy to scan later—useful when reviewing a shell command someone left behind.

You can apply a change to more than one category at once. For example, chmod go-r file.txt removes read permission from both the group and other users. The letters a and ugo refer to all three categories, though the exact result can also be affected by the system’s default permission mask, called umask.

Numeric permissions: compact, but worth decoding

chmod also accepts numbers, often called octal notation. Each permission has a value:

  • Read = 4

  • Write = 2

  • Execute = 1

Add the values to describe each category. The first digit applies to the owner, the second to the group, and the third to others.

For example:


chmod 640 report.txt

The numbers mean:

  • 6 for the owner: read (4) plus write (2)

  • 4 for the group: read only

  • 0 for others: no access

Another familiar setting is:


chmod 755 script.sh

That gives the owner read, write, and execute permissions. The group and others get read and execute permissions, but not write access.

Numeric notation is compact, especially when setting a complete permission pattern. But it replaces the existing permissions for those categories, so it’s worth checking what the digits mean before running the command. A quick mental sum can prevent a much broader change than intended.

Permissions matter—but they aren’t the whole story

Setting execute permission does not automatically make a file run successfully. The file still needs suitable contents, and the system must be able to interpret them. For a shell script, that often means the script has a valid first line, such as #!/bin/bash, and contains commands the shell can run.

Likewise, read permission doesn’t always guarantee that a user can access a file. The user also needs permission to pass through the directories leading to it. Linux checks access along the path, a bit like a series of doors: an open door at the end doesn’t help if an earlier one is locked.

There are also special permission bits for particular situations, such as setuid, setgid, and the sticky bit. These extend the basic permission model, especially for shared directories and certain system programs. They’re powerful, so they deserve care rather than guesswork.

What chmod does not change

The command’s name comes from “change mode,” referring to permission settings. It does not change who owns a file. The chown command handles ownership, while mv is commonly used to move or rename files.

And while permissions can affect whether a file may be executed, chmod doesn’t run the file or switch some general “execution status” on and off. It sets access rules. The system uses those rules when someone tries to read, change, or run the item.

A small command with a big security role

The chmod command is a basic but important Linux tool. It helps define who can access files and directories, and what they’re allowed to do with them. Used thoughtfully, it supports both everyday collaboration and sound security.

Before changing permissions, it helps to ask a simple question: who needs access, and what kind? Grant only what’s needed, then confirm the result with ls -l. That little pause can save a lot of trouble—especially on a shared system where one overly broad permission can expose far more than a single file.