A
cd ..
System

File Permissions Master Guide

chmod, chown, and Linux permission management made simple.

2025-08-27
linux, permissions, security

Understanding permissions

-rwxr-xr--
  • -: File type (- = file, d = directory)
  • rwx: Owner permissions (read, write, execute)
  • r-x: Group permissions
  • r--: Others permissions

Give execute permission

chmod +x script.sh

Set specific permissions (755)

chmod 755 file.txt
  • 7 (Owner): read + write + execute
  • 5 (Group): read + execute
  • 5 (Others): read + execute

Common permission codes

  • 644: Read/write for owner, read-only for others
  • 755: Executable for all, writable by owner
  • 600: Private file, only owner can read/write
  • 777: Full access for everyone (Avoid in production!)

Recursively change permissions

chmod -R 755 /var/www/html

Change file owner

chown username file.txt

Change owner and group

chown username:groupname file.txt

Recursively change ownership

chown -R www-data:www-data /var/www

View file permissions

ls -la file.txt

Set default permissions for new files

umask 022

Was this useful?

Share with your team

Browse More