FAQ - Unix

Back Home Next

What is chmod? 
What are permissions? 
What does 755 mean?

What is chmod? 
What are permissions?
 
What does 755 mean? 

Unix-based servers are set up so that you can determine what type of access is allowed for any file on the system. This access is mostly divided into three categories: read (meaning people can look at the contents of the file), write (meaning that people can change, delete, or otherwise alter the file), and execute (usually meaning that people can execute or run the file -- usually a program). For each of these three types of permissions, there are three types of people who you can allow to read/write/or execute a file or program.

First, there's the "owner" of the file. This is a computer-type ownership, and not a financial or other ownership. On the Unix-based system, usually your username will be the owner of any file you create. Next, there is the "group" ownership. Unix users are usually part of a group like "staff," "users," "bums" etc. It doesn't matter what the group is named, it's just to let you give a set of permissions to a whole bunch of people (or just two) at once. Last, there is the "world," which means "everyone."

Each file has permissions set up like this:

        Owner      Group        World
         r w x        r w x         r w x

If a permission (e.g. "read" or "r" is turned on, the computer sees it as a 1. If a permission is turned off, the computer sees it as a zero. Okay, so, if we wanted to give permission for a cgi program so that the owner could read/write/execute it, the group could read and execute it, and everyone else could read and execute it, it would look like this:

  Owner    Group    World
  r w x    r - x    r - x
  1 1 1    1 0 1    1 0 1

Now, 111 in binary is 7. 101 in binary is 5, so the permissions we want would be 755. If I only wanted people to be able to read the file, it would look like this:

  Owner    Group    World
  r w -    r - -    r - -
  1 1 0    1 0 0    1 0 0

Which works out to 644. You may now feel free to run screaming. :-)
 

Last modified: 02/15/2006 03:28 PM .