Welcome to Team5 Unix Live

Permissions

File and Directory Permissions

Intro to permissions

Each file and directory has permissions as to who can read it, write to it, and execute it. These permissions are formatted as “rwxrwxrwx” and “-“.

  • R (read)- contents are readable.
  • W (write)- contents may be written over or appended.
  • X (execute)- it may be executed if it is executable.
  • “-“ = no permissions.

Each iteration of rwx (there are 3) represents who can perform the actions:

  • Owner- the user that owns the file. By default, the owner is the user that created the file.
  • Group- a group of designated users.
  • Others- any others that did not create the file and is not part of a group, like the public.

When you execute the ls -l command, the first field will you show you the permissions of a file or directory. In the example below, the file testfile has the permissions -rw-rw-r--.

ls-l

The interpretation of testfile permissions is that the owner and the group can read and write to the file, but is not allowed to execute it. Any other users are only allowed to read the file.

Permissions are represented by three-digit octal values. To keep things simple, refer to the chart below to help you find the numeric values for the permissions:

chart < Last Lesson Chapter Quiz >