Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Linux File Permissions Explained for Windows Users

· 6 min read · Home Tech

In this article
  1. Why Linux Permissions Differ From Windows
  2. The Three Permission Types and What They Mean
  3. The Three User Classes: Owner, Group, Others
  4. How to Read and Change Permissions
  5. Common Permission Problems and How to Fix Them
  6. Special Permissions: Setuid, Setgid, and Sticky Bit
  7. How This Compares to Windows Permissions
  8. Frequently Asked Questions

Linux file permissions control who can read, write, or execute a file, and Windows users can understand them by thinking of them as a simpler, more explicit version of Windows' read-only and sharing attributes. This guide explains the three permission types, the three user classes, and how to read and change them using commands like chmod and chown. By the end, you’ll be able to interpret the rwx strings you see in file listings and fix common permission errors.

Why Linux Permissions Differ From Windows

Windows typically uses Access Control Lists (ACLs) with complex rules for users and groups, stored in the NTFS filesystem. Linux, by contrast, uses a simpler model based on three permission bits (read, write, execute) applied to three classes (owner, group, others). This design dates back to Unix and remains the foundation of Linux security. Windows users often find Linux permissions more predictable because they are visible in every directory listing and can be changed with a single command.

The Three Permission Types and What They Mean

Each file or directory has three permissions:

  • Read (r) – For files: view the contents. For directories: list the files inside.
  • Write (w) – For files: modify or delete the file. For directories: create, rename, or delete files inside the directory (even if the file itself is read-only).
  • Execute (x) – For files: run the file as a program or script. For directories: enter the directory (e.g., cd into it) and access files inside, even if you can't list them.

Note that on directories, the execute permission is often called “search” permission. Without it, you cannot access any file in that directory, regardless of the file’s own permissions.

The Three User Classes: Owner, Group, Others

Permissions are assigned to three separate classes:

  • Owner (u) – The user who created the file or the one assigned via chown.
  • Group (g) – A named group of users. Every file belongs to one group, and all members of that group share the group permissions.
  • Others (o) – Everyone else on the system who is neither the owner nor in the group.

When you run ls -l, you see a string like -rw-r--r--. The first character indicates the file type (- for regular file, d for directory). The next nine characters are three sets of rwx: first the owner, then the group, then others. A dash means the permission is not granted.

How to Read and Change Permissions

To view permissions, use ls -l or stat. To change them, you use the chmod command. There are two common ways:

  1. Symbolic mode – Use letters: u, g, o, a (all), and operators + (add), - (remove), = (set exactly). Example: chmod u+x script.sh adds execute for the owner.
  2. Numeric mode – Use three digits (0-7) representing binary bits. Read=4, write=2, execute=1. Sum them for each class. Example: chmod 755 file gives owner rwx (7), group r-x (5), others r-x (5).

To change the owner or group, use chown. For example, chown alice:developers file.txt sets the owner to alice and the group to developers. You usually need sudo for these changes.

Common Permission Problems and How to Fix Them

Windows users often encounter these issues:

  • “Permission denied” when trying to open a file – Check if you have read permission (r) on the file and execute (x) on all parent directories.
  • Cannot edit a file even though you own it – The file may be read-only (-r--r--r--). Add write permission with chmod u+w file.
  • Cannot run a downloaded script – Downloaded files often lack execute permission. Use chmod +x script.sh to add it.
  • Files on a mounted Windows drive show odd permissions – NTFS or FAT32 drives are often mounted with default permissions. You can remount with different options, but the Linux permission model doesn’t fully apply to those filesystems.

A common misconception is that deleting a file requires write permission on the file itself. In reality, you need write permission on the directory that contains the file. This is why you can delete a read-only file if you own the directory.

Special Permissions: Setuid, Setgid, and Sticky Bit

Beyond the basic rwx, Linux has three special permission bits:

  • Setuid (s on owner) – When applied to an executable, the program runs with the file owner’s privileges, not the user who launched it. Used for commands like passwd.
  • Setgid (s on group) – On a directory, new files inherit the directory’s group. On an executable, the program runs with the group’s privileges.
  • Sticky bit (t on others) – On a directory, only the file owner (or root) can delete or rename files inside, even if the directory is world-writable. Used on /tmp.

These appear in ls -l as s or t in place of the x position. They are powerful and can be security risks if misused.

How This Compares to Windows Permissions

Windows NTFS permissions are more granular, with separate “modify”, “full control”, and “special permissions” that can be applied to individual users. Linux’s three-class model is coarser but easier to reason about. For example, in Windows you can give one specific user read access while denying another; in Linux, you would need to create a group and add both users to it, then set group permissions. Windows also has inheritance rules that differ from Linux’s simpler model where a directory’s permissions do not automatically apply to its contents (though some tools like setfacl can emulate ACLs).

Frequently Asked Questions

What does chmod 777 do?

It gives read, write, and execute permissions to everyone (owner, group, and others). It is often used for quick fixes but is generally a security risk because any user can modify or delete the file. Use it only for temporary files or in isolated environments.

How do I make a file executable in Linux?

Use chmod +x filename to add execute permission for all users, or chmod u+x filename to add it only for the owner. Then run it with ./filename if it’s in the current directory.

Why do I see drwxr-xr-x for a directory?

The d means it’s a directory. The owner has read, write, and execute (rwx), while the group and others have read and execute (r-x). This is a common default for directories, allowing users to list and access contents but not create new files.

What is the difference between chmod and chown?

chmod changes the permission bits (read, write, execute), while chown changes the owner and group of a file. You use chown when you want to give a file to another user or group, and chmod when you want to adjust what that user or group can do with it.

Can I use Linux permissions on a USB drive formatted as NTFS?

Not directly. NTFS uses its own ACL system, and Linux mounts it with default permissions that you can set at mount time (e.g., uid=, gid=, umask=). The chmod command will not work on NTFS partitions because the filesystem doesn’t store Linux permission bits.

What is the default umask and why does it matter?

The umask is a shell setting that determines default permissions for new files. A typical value is 022, which means new files get 644 (rw-r--r--) and new directories get 755 (rwxr-xr-x). It subtracts from the base 666 for files and 777 for directories. Changing umask affects only files you create in that shell session.