chmod 402 Permission Explained
Summary: chmod 402 gives the owner read, the group no access, and everyone else write.
| Class | Read (4) | Write (2) | Execute (1) | Octal |
|---|---|---|---|---|
| Owner (u) | 4 | |||
| Group (g) | 0 | |||
| Others (o) | 2 |
chmod 402 filename
chmod 402 Breakdown
| Class | Digit | Symbolic | On a file | On a directory |
|---|---|---|---|---|
| Owner (u) | 4 |
r-- |
Read only | Can list names, but not enter |
| Group (g) | 0 |
--- |
No access | Cannot list, enter, or modify |
| Others (o) | 2 |
-w- |
Write only (rarely useful) | No practical effect without x |
Is chmod 402 Safe?
Critical Risk
- Anyone on the system can modify or replace this file.
- Even the owner cannot modify this file without changing permissions first.
- Unusual: a lower class has permissions the class above it lacks.
Common Use Cases
402 is uncommon in standard Linux setups. The closest widely used permission is chmod 400.
chmod 402 Command Examples
# Apply using octal mode
chmod 402 filename
# Apply using equivalent symbolic mode
chmod u=r,g=,o=w filename
# Recursive command warning:
chmod -R 402 /path/to/dir
# Note: -R applies the same mode to files and directories. Use find to treat them separately:
find /path/to/dir -type f -exec chmod 402 {} +
# Verify permissions
stat -c '%a %A %n' filename # Linux
stat -f '%Lp %Sp %N' filename # macOS
# Example ls -l output:
-r------w- 1 alice staff 1024 Jan 15 10:00 example.txt
umask Relationship
A umask of 375 makes new directories 402 and new files 402. Test umask values with our interactive Umask Calculator.
Frequently Asked Questions
What does chmod 402 mean?
chmod 402 gives the owner read, the group no access, and everyone else write. In octal notation, the owner receives 4 (read), the group receives 0 (no access), and others receive 2 (write).
Is chmod 402 safe?
chmod 402 is classified as Critical Risk. Anyone on the system can modify or replace this file.
What is chmod 402 in symbolic notation?
In symbolic notation, chmod 402 is represented as r------w-. You can apply this permission using the equivalent symbolic command "chmod u=r,g=,o=w filename".
Related Permissions
Change one bit: