Unix Permissions Basics

Every file and directory on Unix/Linux has three permission groups: owner, group, and others. Each group can have three permissions: read (r), write (w), and execute (x).

Octal Notation

Permissions are often expressed as three-digit octal numbers:

  • r = 4, w = 2, x = 1
  • rwx = 4+2+1 = 7
  • rw- = 4+2+0 = 6
  • r-- = 4+0+0 = 4

So chmod 755 means: owner=rwx (7), group=r-x (5), others=r-x (5).

Common Permission Patterns

  • 644 — standard files (owner reads/writes, everyone else reads)
  • 755 — executable files and directories
  • 600 — private files (SSH keys, configs with secrets)
  • 700 — private directories
  • 777 — everyone can do everything (almost never what you want)

Symbolic Notation

You can also use symbolic notation: chmod u+x file adds execute for the owner. chmod go-w file removes write for group and others. The letters are: u (user/owner), g (group), o (others), a (all).

Calculate Permissions Instantly

Use the chmod Calculator on CodeKitLab to toggle permission checkboxes and instantly see both octal and symbolic notation. It's the fastest way to get the right permissions without memorizing tables.

Directory Permissions

For directories, the permissions mean something slightly different:

  • r — list the directory contents
  • w — create, rename, or delete files in the directory
  • x — enter the directory (cd into it)

A directory with r but not x lets you list files but not access them. A directory with x but not r lets you access files if you know the name but not list them.

Security Tips

  • SSH keys must be 600 — SSH refuses to use keys with broader permissions
  • Web server files should be 644, directories 755
  • Never use 777 in production
  • Use umask to set default permissions for new files

Unix-filbehorigheter med chmod

Varje fil har behorigheter for agare, grupp och andra: lasa (r), skriva (w) och kora (x). Oktalt: r=4, w=2, x=1. Berakna behorigheter med chmod Calculator.

Unix-Dateiberechtigungen mit chmod

Jede Datei hat Berechtigungen fur Besitzer, Gruppe und Andere: Lesen (r), Schreiben (w) und Ausfuhren (x). Oktal: r=4, w=2, x=1. Berechnen Sie Berechtigungen mit dem chmod Calculator.

Permissions Unix avec chmod

Chaque fichier a des permissions pour le proprietaire, le groupe et les autres : lecture (r), ecriture (w) et execution (x). Octal : r=4, w=2, x=1. Calculez les permissions avec le chmod Calculator.

Permisos Unix con chmod

Cada archivo tiene permisos para propietario, grupo y otros: lectura (r), escritura (w) y ejecucion (x). Octal: r=4, w=2, x=1. Calcula permisos con el chmod Calculator.

أذونات ملفات Unix مع chmod

لكل ملف أذونات للمالك والمجموعة والآخرين: قراءة (r) وكتابة (w) وتنفيذ (x). ثماني: r=4, w=2, x=1. احسب الأذونات باستخدام chmod Calculator.

chmod کے ساتھ Unix فائل اجازتیں

ہر فائل میں مالک، گروپ اور دیگر کے لیے اجازتیں ہوتی ہیں: پڑھنا (r)، لکھنا (w) اور چلانا (x)۔ آکٹل: r=4, w=2, x=1۔ chmod Calculator سے اجازتیں شمار کریں۔