How to manage file permissions in Linux
Updated 11/29/2026
Linux permissions control who can read, write or execute a file. Many "Permission denied" errors and security risks come from wrong permissions.
How to read them
ls -l
A line like -rw-r--r-- means: the owner reads and writes, the group and others only read.
chmod: change permissions
chmod 644 file # owner rw, others r
chmod 755 script.sh # owner rwx, others rx
chmod 600 secret # owner only
chown: change the owner
chown www-data:www-data /var/www/site
chown -R user:user /home/user/data
Good rules
- Web files:
644, directories:755. - Private keys and secrets:
600. - Never use
777, it gives full access to anyone.
Web applications
The web server (usually www-data) must own the application's files. Wrong permissions cause 500 errors, see deploying Laravel to production.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to sync files automatically with Syncthing
Syncthing syncs files in real time between servers and devices, encrypted and without an external cloud.
Updated 11/29/2026Storage & filesHow to self-host S3 storage with MinIO
MinIO gives you S3-compatible storage on your own server, ideal for apps that expect an S3 API.
Updated 11/29/2026Storage & filesHow to encrypt files and backups
Protect sensitive data by encrypting files and backups before storing or transferring them.
Updated 11/29/2026