Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working with a file upload script. I am currently uploading a file and then trying to echo out an anchor linking to that file, but since I used mkdir() with 0700 permissions to upload the file, it won't allow me access to view the file.

I am pretty sure the problem I am experiencing is because of the file permission code I used. The problem is I just don't know what all the different file permission codes are and what they mean.

Can somebody please list out all the different file permissions and what they each do?

share|improve this question

migrated from Jun 6 '10 at 7:42

This question came from our site for professional and enthusiast programmers.

Sounds like a job for Google or Wikipedia or one of the zillions of Linux help sites to me. – High Performance Mark Jun 5 '10 at 22:36
@High Performance Mark: Please, educate yourself on the choices the community made about these kind of issues and accept them. This question has its place here. Your is not helpful at all and against SO's philosophy. – Andrew Moore Jun 5 '10 at 22:38
I understand your concern and if you can provide me with a good google link I would be grateful, since I researched it, but could not find any easy to understand guide on what the codes mean. – zeckdude Jun 5 '10 at 22:41
up vote 8 down vote accepted

Permissions on Unix-like systems are managed in three distinct classes. These classes are known as user, group, and others.


Files and directories are owned by a user. The owner determines the file's owner class. Distinct permissions apply to the owner.

Files and directories are assigned a group, which define the file's group class. Distinct permissions apply to members of the file's group members. The owner need not be a member of the file's group.

Users who are not the owner, nor a member of the group, comprise a file's others class. Distinct permissions apply to others.

The effective permissions are determined based on the user's class. For example, the user who is the owner of the file will have the permissions given to the owner class regardless of the permissions assigned to the group class or others class.


There are three specific permissions on Unix-like systems that apply to each class:

  • The read permission, which grants the ability to read a file. When set for a directory, this permission grants the ability to read the names of files in the directory (but not to find out any further information about them such as contents, file type, size, ownership, permissions, etc.)

  • The write permission, which grants the ability to modify a file. When set for a directory, this permission grants the ability to modify entries in the directory. This includes creating files, deleting files, and renaming files.

  • The execute permission, which grants the ability to execute a file. This permission must be set for executable binaries (for example, a compiled c++ program) or shell scripts (for example, a Perl program) in order to allow the operating system to run them. When set for a directory, this permission grants the ability to traverse its tree in order to access files or subdirectories, but not see files inside the directory (unless read is set).

The effect of setting the permissions on a directory (rather than a file) is "one of the most frequently misunderstood file permission issues".

When a permission is not set, the rights it would grant are denied. Files created within a directory will not necessarily have the same permissions as that directory. The permissions to be assigned are determined using umasks.

Octal Notation

Octal notation consists of a three- or four-digit base-8 value.

With three-digit octal notation, each numeral represents a different component of the permission set: user class, group class, and "others" class respectively.

Each of these digits is the sum of its component bits (see also Binary numeral system). As a result, specific bits add to the sum as it is represented by a numeral:

  • The read bit adds 4 to its total (in binary 100),

  • The write bit adds 2 to its total (in binary 010), and

  • The execute bit adds 1 to its total (in binary 001).

These values never produce ambiguous combinations; each sum represents a specific set of permissions.

Here is a summary of the meanings for individual octal digit values:

0 --- no permission
1 --x execute 
2 -w- write 
3 -wx write and execute
4 r-- read
5 r-x read and execute
6 rw- read and write
7 rwx read, write and execute

Also note that your file might be owned by user foo, Apache typically runs as a different user (let's call it bar). This means that if you want Apache to read it, you need to give group or other (depending of your setup) permission to read your file.

You can find more information about POSIX Filesystem permissions on Wikipedia.

share|improve this answer

Seems like a serverfault question.

For non-system users to have read access on a directory, you need to set the directory as executable.

As for what the numbers mean, it's an octal code number setting all three groups of permissions at once.

R W X  Code
0 0 0  0 No Permission
0 0 1  1 Executable
0 1 0  2 Write
0 1 1  3 Write and execute
1 0 0  4 Read
1 0 1  5 Read and execute
1 1 0  6 Read and write
1 1 1  7 read, write, execute

Simply block these three numbers together with the owner being the first number, the group being the second, and others being the third, and you have yourself the octal permission code.

Usually with file shares, you set files to 744, and directories to 755 because the owner should be allowed to do anything with it, but users and guests (such as anonymous web users) should have just read permissions.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .