CloudLinux.ro
Storage & files

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 pricing

Related tutorials