Unix file permissions

Access to files and directories on a Unix system is granted to three classes of users:

  • the user, the person who owns the file
  • the group, the other users who belong to the same group as the owner
  • others, everyone else in the world

In addition, three types of access can be granted independently to each of the types of users:

  • read access, the ability to read the file (or in the case of a directory, see a listing of the files there)
  • execute access, the ability to run script or program
  • write access, the ability to edit or delete the file (or in the case of a directory, create a file there)

 

To see what the permissions are on your files, type ls -l. The output will look something like this:

drwxr-xr-x   3 janeuser psc12345   104 Apr 17  2017 tests 
-rw-r--r--   1 janeuser psc12345    28 Jul 10  2017 time.php

We need to look at:

  • the file type and the file permissions, ten characters long. More below on this.
  • the user who owns the file (here, janeuser)
  • the file owner’s group (here, psc12345)