Updates and information from the Web Team at Ohlone College.

UNIX file and directory permissions (summary)

To make file readable by others (i.e., the “world”), set the directory containing the files to:

  • drwxr-xr-x
    or
    755

and set the files in the directory to:

  • -rwxr--r--
    or
    644

Explanation of file permissions

There are 3 classes of permissions:

  1. User (sometimes referred to as “owner”)
  2. Group
  3. Others (sometimes referred to as “all” or “world”)

A common notation for permissions is a series of 10 characters, such as:

  • drwxr-xr-x
  • -rw-r--r--
  • -rw-rw-rw-

The first character represents the file type:

  • - regular file
  • d directory

The remaining 9 characters represent 3 permissions for each of the 3 classes:

  • r read on
  • w write on
  • x execute on
  • - off

Directories must have execute permissions, such as:

  • drwx------
  • drwxr-xr-x (most common)
  • drwxrwxr-x
  • drwxrwxrwx

Executable program files, such as CGI scripts, must have execute permissions, such as:

  • -rwxr-xr-x

Regular files must have read and/or write permissions, such as:

  • -rw-r--r-- (most common)
  • -rw-rw-rw-

Read, write, and execute permissions may also be represented in octal notation:

  • 4 read on
  • 2 write on
  • 1 execute on
  • - off

The octal values are added to result in desired read-write-execute permissions:

  • 4 + 2 + 1 = 7 for read-write-execute permissions rwx
  • 4 + 2 = 6 for read-write permissions rw-
  • 4 + 1 = 5 for read-execute permissions r-x
  • 4 = 4 for read permissions r--

Examples of common octal notations are:

  • 755 is same as drwxr-xr-x
  • 644 is same as -rw-r--r--

See File System Permissions in Wikipedia for more information.

No Comments

No comments yet.

Sorry, the comment form is closed at this time.