chmod 4755 Permission Explained: setuid Executable
Summary: Runs with the file owner's privileges.
| Class | Read (4) | Write (2) | Execute (1) | Octal |
|---|---|---|---|---|
| Owner (u) | 7 | |||
| Group (g) | 5 | |||
| Others (o) | 5 |
chmod 4755 filename
chmod 4755 Breakdown
| Class | Digit | Symbolic | On a file | On a directory |
|---|---|---|---|---|
| Owner (u) | 7 |
rwx |
Full access | Full access: list, enter, create, delete |
| Group (g) | 5 |
r-x |
Read and execute | Can list and enter |
| Others (o) | 5 |
r-x |
Read and execute | Can list and enter |
| Special | 4 |
— | setuid (runs with owner privileges) | |
Is chmod 4755 Safe?
High Risk
- Runs with the file owner's privileges. A bug in this program can lead to privilege escalation.
- Any user can read this file — never use it for secrets such as keys or .env files.
When not to use it
- Interpreted shell scripts (Linux kernels ignore setuid on scripts for security reasons)
- Custom user applications without rigorous buffer overflow and path traversal auditing
Common Use Cases
- Core system utilities like /usr/bin/passwd that temporarily elevate unprivileged users to update system files like /etc/shadow
- Ping utilities that require raw socket network capabilities
chmod 4755 Command Examples
# Apply using octal mode
chmod 4755 filename
# Apply using equivalent symbolic mode
chmod u=rwx,g=rx,o=rx,u+s filename
# Recursive command warning:
chmod -R 4755 /path/to/dir
# Note: -R applies the same mode to files and directories. Use find to treat them separately:
find /path/to/dir -type d -exec chmod 4755 {} +
# Verify permissions
stat -c '%a %A %n' filename # Linux
stat -f '%Lp %Sp %N' filename # macOS
# Example ls -l output:
-rwsr-xr-x 1 alice staff 1024 Jan 15 10:00 example.txt
umask Relationship
A umask of 022 makes new directories 4755. Test umask values with our interactive Umask Calculator.
Frequently Asked Questions
What does chmod 4755 mean?
Runs with the file owner's privileges. In octal notation, the owner receives 7 (read/write/execute), the group receives 5 (read/execute), and others receive 5 (read/execute).
Is chmod 4755 safe?
chmod 4755 is classified as High Risk. Runs with the file owner's privileges. A bug in this program can lead to privilege escalation.
What is chmod 4755 in symbolic notation?
In symbolic notation, chmod 4755 is represented as rwsr-xr-x. You can apply this permission using the equivalent symbolic command "chmod u=rwx,g=rx,o=rx,u+s filename".
What is the security risk of setuid?
When an executable has the setuid bit (chmod 4755), it executes with the permissions of the file owner (often root) regardless of who launches it. If the executable contains a security flaw, vulnerability, or environment variable bug, an unprivileged local user can exploit it to spawn an interactive shell with root privileges.
Related Permissions
Change one bit: