How to manage file permissions in Linux
Updated 7/20/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 encrypt files and backups
Protect sensitive data by encrypting files and backups before storing or transferring them.
Updated 7/20/2026Storage & filesHow to sync files automatically with Syncthing
Syncthing syncs files in real time between servers and devices, encrypted and without an external cloud.
Updated 7/20/2026Storage & filesHow to manage disk space and partitions
See how your disks are organized, mount a new disk and expand space when you need it.
Updated 7/20/2026