One bad chmod command can turn a working Linux server into a security problem, a broken deployment, or a mystery that takes an hour to unwind. If you manage Linux systems, Linux permissions are not a beginner topic you can skip; they are part of everyday security and file management.
Microsoft SC-900: Security, Compliance & Identity Fundamentals
Learn essential security, compliance, and identity fundamentals to confidently understand key concepts and improve your organization's security posture.
Get this course on Udemy at the lowest price →This guide breaks down read, write, and execute permissions in practical terms. You will see how permissions work on files and directories, how ownership changes access, why sudo is not the same as file access, and how to recognize common modes like 644, 755, and 700. The same fundamentals also connect to identity and access concepts covered in Microsoft SC-900: Security, Compliance & Identity Fundamentals, especially around least privilege and access control.
Linux Permissions Basics
Linux file access starts with three permission classes: user, group, and others. The user is the file owner, the group is the owning group, and others means everyone else on the system. Each class gets its own read, write, and execute settings, which is why two users can look at the same file and have completely different outcomes.
This separation is the foundation of multi-user Linux. A shared server might host application code, log files, deployment scripts, and user data, all with different rules. The goal is simple: give each person or process only the access it needs.
How Permissions Appear in ls -l
Run ls -l and you will see a permission string like this:
-rw-r----- 1 alice developers 8421 May 13 09:10 report.txt
The first character shows the file type: - for a regular file, d for a directory, and other letters for special types. The next nine characters are grouped into three sets of three: user, group, and others. Each set shows r for read, w for write, and x for execute.
- -rw-r—– means the owner can read and write.
- rw- for the group means group members can read and write.
- — for others means everyone else has no access.
Ownership matters because Linux checks the owner first, then the group, then others. If you are the owner, your user permissions apply. If not, Linux checks whether you are in the owning group. This is where group design becomes part of file management, not just administration.
Permission checks are local and deterministic: Linux does not guess. It evaluates ownership, mode bits, and any higher-level controls in order.
One common mistake is confusing file permissions with administrative privileges. sudo does not magically change the file mode; it lets a permitted user run a command with elevated privileges. That is very different from granting permanent write access to a file or directory.
For a broader identity-and-access perspective, Microsoft documents access control and privilege concepts in Microsoft Learn, while the Linux side of the equation is governed by the actual file mode and ownership on the system.
Understanding Read, Write, and Execute
The three permission bits are simple on paper, but their meaning depends on whether you are dealing with a file or a directory. Read lets you view data, write lets you change data, and execute lets you run a file as a program. On directories, those same bits control listing, modifying directory entries, and traversing the path.
That difference is where many permission problems start. A user may have read access to a file but still be blocked from reaching it if a parent directory is missing execute permission. Or a script may be readable but not executable, which means it can be opened as text but not launched directly.
Permissions on Files
For a regular file, read means you can inspect the contents with tools like cat, less, head, or grep. Write means you can alter, append, truncate, or replace the file contents. Execute means the kernel can treat the file as a program or script.
For example, a log file may be readable but not writable so developers can inspect it without changing it. A shell script may be executable so users can run it, but not writable so they cannot alter automation logic. A sensitive password file may be set to 600, allowing only the owner to read and write it.
Permissions on Directories
Directories behave differently. Read on a directory means you can list filenames. Write means you can create, rename, or delete entries. Execute means you can enter the directory and access items inside it if you know their names.
This is why directory execute permission is often misunderstood. A directory without execute permission is like a hallway with no doorway: you may know the room exists, but you cannot traverse into it. That matters for automation, shared folders, and nested path access.
Official Linux documentation and vendor guidance often frame these controls as basic access control primitives. The same least-privilege thinking appears in the Microsoft Learn identity guidance and in the NIST access control concepts used across security frameworks such as NIST CSF and SP 800 resources.
Pro Tip
If a user says “I can read the file but still can’t open it,” check the parent directories. The missing piece is often execute permission on one directory in the path, not the file itself.
Read Permission In Practice
Read permission is the most visible permission because it controls inspection. If a user can read a file, they can use cat to dump it, less to page through it, head to sample the beginning, and grep to search it. That makes read access essential for troubleshooting, auditing, and support.
Read access also determines whether someone can inspect configuration files and logs. A sysadmin may want developers to read application logs but not alter them. A security analyst may need read-only access to configuration files to validate hardening. On the other hand, a secrets file should often be readable only by one account or a tightly controlled group.
Why Read Access Can Be Useful Without Edit Rights
Many production files are intentionally readable but not editable by most users. That pattern protects stability. If too many people can edit config files, one accidental change can break a service, introduce a syntax error, or expose credentials.
Consider a web server log owned by root with a group like adm. A support engineer may need read access to troubleshoot failed logins, but write access would be unnecessary and risky. Likewise, a team may share a read-only status file so everyone sees the same data without risking accidental changes.
catfor quick output of small files.lessfor paging through longer files.headfor the first lines of a log or config.grepfor searching patterns in readable text.
Lack of read access slows debugging because you lose visibility. If you cannot inspect a config file, you cannot confirm whether a service is using the expected value. That is why file permissions are as much about operational support as they are about security.
For standards-based thinking about access and control, NIST guidance at csrc.nist.gov is useful when you want to connect Linux permissions to broader security governance and least-privilege design.
Write Permission In Practice
Write permission allows a file to be changed. That can mean opening it in nano or vim, redirecting new content into it, appending text, truncating it, or replacing it completely. Write access is powerful because it can alter both data and behavior.
One important point: write access without read access is possible, but it is unusual and often awkward. A process may be allowed to append to a log file without being allowed to read the old entries. That can be useful in tightly controlled environments, but for humans it usually makes little sense because you cannot verify what you changed.
Common Ways Write Access Is Used
In practice, write access shows up in collaboration folders, application upload directories, and shared project spaces. For example, a content management directory may let authenticated users add files, but not execute anything from that location. A deployment account may need write access to a release directory so it can update binaries or configuration files during a rollout.
Shell redirection is another common case. A command like echo "updated" >> notes.txt appends text, while command > output.txt overwrites the destination. If the user lacks write permission, the shell will fail even if the command itself runs fine.
- Append adds to the end of a file.
- Overwrite replaces existing contents.
- Truncate can clear a file before writing new data.
Granting write access too broadly creates real risk. Users can deface scripts, inject malicious code, corrupt logs, or break service files. This is why shared directories should be designed carefully and why world-writable settings should be rare.
Write access is not just “edit permission.” In Linux, it can be the difference between controlled change and system instability.
That same principle shows up in security frameworks used by IT teams. Least privilege is a core idea in both Linux administration and identity governance, which is why it appears in Microsoft security guidance and in NIST-aligned access control practices.
Execute Permission In Practice
Execute permission tells Linux that a file can be run as a program. This applies to compiled binaries, shell scripts, and application launchers. Without execute permission, a file may still be readable, but the kernel will not launch it as a process.
For shell scripts, the shebang line matters. A script that starts with #!/bin/bash or another interpreter path tells the system which program should interpret the file. Without a proper shebang, a script may fail unless you invoke it explicitly with the right shell.
Reading a Script Is Not the Same as Running It
If a script is readable but not executable, you can inspect its contents with cat or less, but you cannot launch it directly with ./script.sh. You may still run it by calling the interpreter explicitly, such as bash script.sh, if the interpreter itself has permission to read the file.
This distinction matters in automation. Scheduled tasks, deployment hooks, startup scripts, and cron jobs all depend on execute permission. If a script loses its execute bit, a scheduled job may fail even though the file content is unchanged.
Why Directories Need Execute Permission
Directories need execute permission for traversal. When a process accesses /opt/apps/release/bin/run.sh, every directory in the path must allow traversal. This is why an application may work for one user and fail for another even when the final file seems properly configured.
In real environments, execute permission is often combined with read on scripts and binaries, but not always. Some locked-down binaries are executable but not readable by ordinary users. That is a valid pattern when the intent is to run code without exposing its contents.
For security and compliance teams, this aligns with broader access-control thinking in frameworks such as NIST and Microsoft identity guidance. It is also a practical control to reduce accidental exposure of automation logic, credentials, and system scripts.
Warning
Do not assume a file is safe just because it is not writable. A readable script can still reveal logic, file paths, environment variables, and hard-coded secrets.
Permissions on Directories
Directory permissions confuse people because they do not behave like file permissions. A directory is a container, so the permission bits control what you can do with entries inside it, not the content of a single object. Once you understand that, permission errors become much easier to diagnose.
Read on a directory lets you list the names inside it. Write lets you create, rename, or delete entries. Execute lets you traverse the directory and access its contents by name.
Common Directory Combinations
| 755 | Owner can read, write, execute; everyone else can read and traverse. Common for public directories and web content. |
| 700 | Only the owner can access the directory. Common for private data, scripts, and sensitive workspace folders. |
| 750 | Owner has full access; group can read and traverse; others have no access. Useful for controlled team sharing. |
The execute bit on a directory is often the decisive one. Without it, a user may know the directory exists but still cannot enter it or access files inside it. That is why “permission denied” can appear even when the file mode looks correct.
On a shared server, directory design is part of security architecture. A team may need r-x on a project folder so members can review code and navigate structure, but only the build account should have write permission. That is a clean separation between collaboration and control.
Official vendor documentation, including Linux-adjacent guidance in Microsoft Learn, reinforces the same principle: access should match the task. The file system is no exception.
Viewing and Changing Permissions
The main tools you use every day are ls -l, chmod, chown, chgrp, and umask. Together they control who owns content, who can access it, and what default permissions new files receive.
Start with inspection. ls -l shows the mode bits, owner, and group. If the ownership or mode is wrong, you can correct it with the appropriate command rather than guessing.
Symbolic Mode with chmod
Symbolic mode uses letters like u, g, o, and a to target user, group, others, or all. For example:
chmod u+x script.sh
chmod go-r secret.txt
chmod a+r report.txt
This style is readable and safe when you want to make a specific change without recalculating the entire mode. If a script already has the right permissions except for the execute bit, chmod u+x is much safer than replacing the whole mode blindly.
Numeric Mode with Octal Notation
Octal notation is faster when you know the target pattern. 644 means owner read/write, group read, others read. 755 means owner full access, everyone else read and execute. 700 means only the owner has access.
- 600 for private files like keys or personal notes.
- 644 for readable documents or static content.
- 755 for executable scripts or public directories.
- 700 for private directories or sensitive admin files.
Ownership and Default Creation Rules
chown changes file ownership, and chgrp changes group ownership. These commands matter when a file has the wrong owner after a copy, restore, or deployment. If the owner is wrong, permission checks may fail even if the mode bits look fine.
umask controls default permissions for newly created files and directories. It subtracts permissions from the system default, which is why two shells can create different file modes depending on their umask settings. In practice, this is a quiet but important part of secure file management.
For official background on access-control logic and privileged operations, the Microsoft security documentation at learn.microsoft.com is a useful reference point, while Linux behavior itself is determined locally by the file system and process identity.
Special Permission Bits
Beyond the basic read, write, and execute bits, Linux also supports setuid, setgid, and the sticky bit. These are advanced controls, and they should be used carefully because they can create powerful exceptions to normal file access rules.
They are useful in legitimate system design, but they also deserve respect. If you misapply them, you can create a privilege exposure or a maintenance headache.
setuid and setgid
setuid allows a program to run with the file owner’s privileges rather than the caller’s. This is why certain system tools can perform privileged tasks on behalf of standard users. It is powerful, but it also expands the blast radius if the program has a bug.
setgid changes group behavior. On executables, it can run a program with the file’s group privileges. On directories, it can help shared folders inherit the directory’s group, which is useful for team project spaces and controlled collaboration.
The Sticky Bit
The sticky bit is often used on shared directories like /tmp. It prevents users from deleting or renaming files they do not own, even if the directory itself is writable. That is exactly the kind of protection you want in a shared scratch space.
Without the sticky bit, any writable shared directory can become chaotic. One user could remove another user’s file just because they have write permission on the directory. The sticky bit stops that.
These special bits should be reserved for cases where the benefit is clear and the security review is done. The same discipline appears in compliance frameworks and hardening guidance, including NIST publications at csrc.nist.gov.
Note
If you inherit a system with setuid files in unusual places, review them carefully. Special bits are normal in core system utilities, but they are not something to scatter across application directories.
Common Permission Patterns
Some permission modes show up again and again because they fit common use cases. Learning these patterns helps you spot problems quickly and choose sensible defaults when you create files or directories.
644, 600, 755, and 700 are the modes administrators see most often. Each one reflects a different balance between access and restriction.
Typical File and Directory Modes
- 644 for ordinary files that many users need to read but not change.
- 600 for sensitive files such as private keys, tokens, or personal configs.
- 755 for scripts, binaries, and public directories that must be traversable.
- 700 for private folders, admin-only content, and restricted work areas.
Scripts often use 755 because they must be executable by more than one user, but not necessarily editable by those users. Sensitive files often use 600 because the contents should only be visible to the owner. That is a clean and common rule of thumb.
For directories, 755 is common for public web content, while 700 is better for private workspace folders or credential stores. If a directory should be shared within a team, 750 or similar group-based modes often make more sense than opening access to everyone.
Server environments generally need tighter defaults than a personal workstation. On a multi-user server, every unnecessary permission is another chance for accidental disclosure or unintended modification. That is why least privilege is not theoretical; it is practical system hygiene.
Security guidance from organizations such as NIST and Microsoft aligns with that approach. If the permission pattern is too broad for the task, it should be tightened.
Troubleshooting Permission Errors
“Permission denied” is not a root cause. It is a symptom. The real issue might be ownership, a missing mode bit, a blocked directory in the path, or a higher-level policy such as ACLs, SELinux, or AppArmor.
The fastest way to debug is to identify exactly what operation failed. Was the user trying to read a file, write to it, or execute it? Was the file itself accessible, but one parent directory not traversable?
Practical Debugging Steps
- Check the file mode with
ls -l. - Check ownership and group membership.
- Inspect every directory in the path with
ls -ld /path /path/to /path/to/file. - Confirm whether the user needs read, write, or execute permission.
- Test whether
sudois appropriate for a one-time administrative action. - Look for ACLs or security policies if the basic permissions look correct.
sudo is useful when an administrative action is needed once. It is not always the right fix for a permissions problem. If a user needs ongoing access, changing the file’s owner, group, or mode is usually cleaner and safer than telling them to keep using elevated privileges.
Advanced controls can override basic expectations. Access Control Lists, SELinux, and AppArmor can all block or narrow access even when the mode bits look right. That is why Linux troubleshooting often requires checking more than one layer.
For authoritative policy and hardening references, NIST is the right place to start at csrc.nist.gov. If you are mapping Linux access issues to identity and compliance concepts, the Microsoft SC-900 material is also a useful conceptual bridge.
Permission troubleshooting is path-aware. A file can be perfectly readable and still fail if one directory above it blocks traversal.
Best Practices for Secure Permission Management
The safest Linux permission model is the one that gives the minimum access required and no more. That is the practical meaning of least privilege. It reduces mistakes, limits damage from compromised accounts, and makes audits easier.
Restrict sensitive files to the smallest possible user set. If only one service account needs a credential file, do not leave it world-readable. If only one team needs access to a project directory, use group-based permissions instead of opening it to everyone.
What Good Permission Hygiene Looks Like
- Use group access for controlled collaboration.
- Avoid world-writable files unless the design truly requires them.
- Audit regularly with
find,ls, and security reviews. - Document exceptions such as setuid, setgid, and sticky bit usage.
- Match permissions to data sensitivity, not convenience alone.
World-writable permissions are especially dangerous on shared systems. They make accidental corruption easier and malicious tampering easier. If you must allow broad write access, use additional controls such as a controlled upload directory, ownership checks, or a sticky bit on the shared folder.
Regular audits matter because permissions drift over time. A file copied from another host may keep the wrong mode. A deployment script may create files with unexpected defaults because the shell’s umask is different. A rushed fix may leave a directory open longer than intended.
For workforce and governance context, the principles behind secure permission management align with NIST, Microsoft identity guidance, and the access-control concepts used across IT operations and compliance. ITU Online IT Training’s Microsoft SC-900 course is relevant here because it helps connect identity, compliance, and security fundamentals to real operational controls.
Key Takeaway
Good permission management is not about making everything restrictive. It is about giving the right access to the right identity at the right time, then removing anything extra.
Microsoft SC-900: Security, Compliance & Identity Fundamentals
Learn essential security, compliance, and identity fundamentals to confidently understand key concepts and improve your organization's security posture.
Get this course on Udemy at the lowest price →Conclusion
Linux permissions boil down to three core actions: read, write, and execute. On files, those bits control inspection, modification, and running code. On directories, they control listing, creating or deleting entries, and traversing the path.
That distinction is where most real-world mistakes happen. A user may have access to a file but still be blocked by a parent directory. A script may be readable but not executable. A directory may look open but still be unusable without execute permission.
The practical patterns are easy to remember: 644 for readable files, 600 for private files, 755 for executable files and public directories, and 700 for private directories. When in doubt, test on harmless sample files and directories before touching production paths.
If you want to keep building confidence, practice with chmod, ownership changes, and directory traversal on a lab system. The more comfortable you are with permission patterns, the faster you will diagnose errors and the safer your Linux administration will be.
For deeper context on security and identity fundamentals, keep the SC-900 material in view and pair it with official references such as NIST and Microsoft Learn. Permission awareness is basic, but it is also one of the fastest ways to improve everyday system security and file management.
Microsoft® is a trademark of Microsoft Corporation. SC-900 is a trademark of Microsoft Corporation.