How do Linux read, write and execute permissions work for files and directories?
Linux permission bits distinguish the owner, group and other users. On a regular file, execute permits execution when other conditions allow it; on a directory, execute permits traversal. Reading a file can still fail when a parent directory blocks traversal, even if the file’s own mode looks permissive.
Before you start
- An authorised SSH session on the Linux server.
Instructions
1. Inspect the file and its parent
Check both objects rather than treating the file as an isolated permission decision. Symbolic links and access-control lists can add context that a short listing does not fully explain.
ls -ld -- "$HOME/server-notes"
ls -l -- "$HOME/server-notes/notes.txt"Read the owner and group names, then the three sets of r, w and x bits. A + marker commonly indicates additional ACL information.
2. Inspect an exact numeric mode
stat makes the stored mode explicit. The example only reads metadata and is useful when a deployment procedure specifies a particular mode.
stat -c "%a %U:%G %n" -- "$HOME/server-notes/notes.txt"%a is the octal permission mode, %U and %G are the owner and group, and %n is the pathname.
Check the result
- Explain which identity requires which access before making a change. A mode that works for one application may expose another application’s secrets.
Troubleshooting
- Permissions look correct but access is denied
- Check parent traversal, ACLs, security labels and mount options. Avoid broad permission changes that hide the real cause.
Official references
Use the documentation for your installed version when a flag, service name or platform feature differs.
