Linux file permissions and chmod explained (755, 644)
Every file on Linux has three sets of permissions. chmod calculator converts between numbers and letters.
Steps
- Type permissions as 755 or rwxr-xr-x.
- Read who can read, write or run.
- Copy the
chmodcommand.
Use cases
- Setting up web server folders.
- Fixing “permission denied” errors.
- Reading ls -l output.
Tips
- Read is 4, write is 2, execute is 1. Add them per class: 7 is rwx, 5 is r-x.
- 644 for files and 755 for folders and scripts is a common safe default.
- Avoid 777. It lets anyone change the file.