Meta Description: Confused by -rwxr-x--- in ls -l? Decode this Linux permission, learn the chmod 750 command, and fix 'permission denied' errors step-by-step.
Anatomy of -rwxr-x---: Decoding the Triads
Have you ever stared at a terminal output, saw -rwxr-x---, and felt a wave of confusion? It looks like a corrupted file path, or perhaps a cryptic version number. If you’ve ever typed that string into Google and found download pages for Linux distributions instead of a technical explanation, you’re not alone. The SERP is often flooded with noise, but the reality is much simpler.
Linux -rwxr-x--- is not a link. It’s a visual representation of file permissions found in the ls -l command output. It tells you exactly who can read, write, or execute a file. To understand this, we need to look past the dashes. This string is composed of three triads: Owner, Group, and Others. Once you see the pattern, it stops being code and starts looking like logic. The owner has full control. The group has read and execute rights. Everyone else? Locked out.
Understanding Owner, Group, and Other
Let’s break down that string character by character. It’s easier than it looks.
File Type Owner Group Others
| | | |
| r w x r - x - - -
-rwxr-x---
The first character (the - in this example) defines the file type; a dash means it’s a regular file, while an l would mean a symbolic link.
The next three characters (rwx) are the Owner permissions. The user who created the file has read, write, and execute access. This is standard. You need all three to modify and run your own scripts.
The middle three (r-x) belong to the Group. Here, the dash is crucial. It means the group can read (r) and execute (x) the file, but they cannot write to it. No modifications allowed for the team, just usage.
Finally, the last three (---) are for Others. This is everyone else on the system. The three dashes mean zero access. No read, no write, no execute. This is the security wall.
Interpreting the Execute Bit (x)
In my 15 years of system administration, the most common point of failure is misunderstanding the x bit. For binary applications, x means "run this program." For scripts (like .sh files), x means "allow the shell to interpret this file." Without it, you’ll get a permission error even if you can read the code.
Why does the Group have x but not w? This is a deliberate design choice for shared environments. Think of a web server setup. The web server runs under a specific group. You want the group to be able to execute the application or read the config, but you definitely don’t want the web server process to be able to overwrite your source code or config files. If you’re a developer working on a shared project, you might find yourself frustrated if you can’t edit a file you didn’t create, but that’s the trade-off for stability.
Setting Permissions: Chmod 750 & Numeric Modes
Now that we’ve decoded the visual string, let’s talk about how to set it. You have two ways to do this: symbolic (using letters) or octal (using numbers). Most professionals prefer the octal method because it’s faster and less prone to syntax errors.
Translating -rwxr-x--- to Octal Notation
Linux uses a base-8 (octal) system to represent these permissions. Each permission bit has a value:
- Read (r) = 4
- Write (w) = 2
- Execute (x) = 1
To get the number, you add them up for each triad:
- Owner (rwx): 4 + 2 + 1 = 7
- Group (r-x): 4 + 0 + 1 = 5
- Others (---): 0 + 0 + 0 = 0
Combine them, and you get 750. This is why the command is chmod 750. It’s not magic; it’s just binary math made decimal-friendly. I always keep a mental shortcut: if you see r-x, it’s almost always a 5. If you see rw-, it’s a 6.
Command Examples: Changing to 750
To apply these permissions, you use the chmod command. Here is the standard syntax:
chmod 750 filename.sh
If you want to be extra explicit and avoid any confusion, you can use the symbolic syntax, though I find it clunkier for quick edits:
chmod u=rwx,g=rx,o= filename.sh
u=rwx: Set User to read/write/execute.g=rx: Set Group to read/execute.o=: Set Others to nothing.
One critical note: if you don’t own the file, this will fail. You’ll need sudo privileges to change permissions on a file owned by root or another user. I’ve seen junior engineers spend an hour debugging why chmod doesn’t work, only to realize they weren’t the file owner. Check with ls -l first.
Security Best Practices: 750 vs 755 vs 740
Choosing the right permission mask is less about what works and more about what should work. This is where the linux file permissions rwx concept becomes a security strategy.
When to Use -rwxr-x--- (750)
Use 750 when you have a trusted team. It’s the gold standard for:
- Shared development scripts: A dev team uses the same API key or connection string in a shell script. Only they should see it.
- Service configurations: Config files that contain database credentials. The service group needs to read them; the general public (or other unprivileged users) should not.
Compare this to 755 (rwxr-xr-x). 755 is "world-readable." It’s fine for a public-facing binary like /usr/bin/curl, but terrible for your .env file. If your application has a vulnerability that allows command injection, an attacker can read a 755 file. With 750, they hit a dead end.
Risks of Excessive Permissions
I recall a incident (anonymized for security) where a staging server had logs set to 777 (rwxrwxrwx) to "debug" an issue. A junior dev left it there. Weeks later, a low-privilege user exploited a weak dependency to drop a cron job into that readable log directory, executing arbitrary commands.
POSIX access control is the baseline, but it’s a blunt instrument. It doesn’t matter who a user is; it only matters if they belong to the right group or are the owner. If you give Others execute permissions on a critical binary, you’re inviting trouble. The --- in rwxr-x--- is your firewall. Don’t compromise it for convenience.
Troubleshooting: Why Your File Won't Execute
You’ve set the permissions, but you still get "Permission Denied." What’s wrong? This is a classic "why can't I execute -rwxr-x--- binary" scenario. The syntax is correct, but the context might be off.
Common 'Permission Denied' Causes
Before you panic, run this diagnostic trio:
-
Check your identity:
id groupsAre you actually in the group that owns the file? If the file is
group:devteamand youridshows you are ingroup:qa, you are in the "Others" category. You have no access. -
Verify Ownership:
ls -l filename.shWho owns it? If it’s
root, and you’reuser, you can’t change the permissions withoutsudo. -
The Execute Bit Check: Look at the specific character for your context. If you’re in the group, look at the 4th, 5th, and 6th characters. If that
xis missing, you can’t run it.
Advanced Issues: SELinux and Filesystems
If the above checks out, you’re dealing with advanced Linux concepts.
SELinux: On RHEL or Fedora, standard permissions are just the first gate. SELinux is the second. A file can have 750 permissions, but if the SELinux context is httpd_sys_content_t instead of bin_t, it won’t execute properly in a service context. Check with:
ls -Z filename.sh
If you see a mismatch, use restorecon -v filename.sh to fix the label.
Filesystem Mounts: Some filesystems (like NFS or FAT32) do not support Unix permission bits. If you mount a USB drive with noexec, no file on it will execute, regardless of chmod. Check /proc/mounts to see if your filesystem has the exec option enabled.
FAQ
What is the numeric equivalent of -rwxr-x---?
The numeric equivalent is 750. This is derived by summing the permission values for each user class: Owner (4+2+1=7), Group (4+0+1=5), and Others (0+0+0=0).
How do I change a file from -rwxr-x--- to -rwxr-xr-x?
To change the permissions to allow "Others" read and execute access, use the chmod 755 filename command. This shifts the security posture from "group-private" to "publicly accessible." Only do this if the file is intended for general use, as it exposes the file to any user on the system.
Can non-owner users execute a file with -rwxr-x--- permissions?
Yes, but only if they belong to the specific group listed in the ls -l output. If a user is not the owner and not a member of the file’s group, they fall into the "Others" category, which has zero permissions (---). To verify group membership, run the groups command.
Conclusion
Understanding linux -rwxr-x--- is about recognizing the triad structure: Owner gets full control, Group gets read/execute, and Others get none. This isn’t just syntax; it’s a security boundary. The chmod 750 command is the standard tool to enforce this state, bridging the gap between symbolic notation and octal reality.
In my experience, most permission errors aren’t about not knowing the command; they’re about not knowing which category you fall into. Check your group membership. Check your SELinux context. And always default to restrictive permissions.
Take Action: Run ls -l in your current directory right now. Find one file that seems too open (like a config file set to 644 instead of 640). Tighten it up with chmod. It takes ten seconds and adds a layer of security. Once you’re comfortable with this, look into Advanced Access Control Lists (ACLs), which offer even finer-grained control than these basic triads.


