Docs / Linux Basics / Understanding Linux File Permissions

Understanding Linux File Permissions

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 345 views · 1 min read

File permissions control who can read, write, and execute files on your server.

Permission Format

-rwxr-xr-- 1 owner group 4096 Jan 1 12:00 file.txt

The permission string breaks down as:

  • r = read (4)
  • w = write (2)
  • x = execute (1)

Three groups: owner, group, others.

Changing Permissions

# Using numbers
chmod 755 file.sh    # rwxr-xr-x
chmod 644 file.txt   # rw-r--r--
chmod 600 secrets    # rw-------

# Using letters
chmod u+x script.sh   # Add execute for owner
chmod go-w file.txt    # Remove write for group/others
chmod -R 755 /var/www  # Recursive

Changing Ownership

chown user:group file
chown -R www-data:www-data /var/www

Common Permission Patterns

  • 755 — directories, scripts
  • 644 — regular files
  • 600 — sensitive files (SSH keys, configs with passwords)
  • 700 — private directories

Was this article helpful?