[Introduction to UNIX for Web Developers]
[Spacer] [Table of Contents]
[Next Page]
[Previous Page]
[Spacer]
Permission Bits
Okay, that was quite a sidetrack. Let's return to permissions.

If you recall, the "ls -l" utility displayed several permission-related fields: Namely, the permission bits, the owner and the group name. We can use these three bits of information to determine who can read a file, delete or modify a file, or execute it if it is executable.

Let's look at the permission bits.

The permission bits specify three sets of three security specifications. Specifically, they define:

  • Is the file readable by the owner?
  • Is the file writable (modify or delete) by the owner?
  • Is the file executable by the owner?

  • Is the file readable by users in the specified group?
  • Is the file writable by users in the specified group?
  • Is the file executable by users in the specified group?

  • Is the file readable by any old user?
  • Is the file writable by any old user?
  • Is the file executable by any old user?

These 9 fields are represented in that order in the permission bits field of the ls-l command. If there is a "-" in the field that means that the file is "not" readable, writable, or executable depending on the field.

[Permission Bits]

Of course, this is best shown by example. Consider the following:

Listing Explanation
rwxrwxrwx Readable, writable and executable by owner, group and world (everyone)
rw-rw-rw readable and writable by everyone but executable by no one
rwx------ readable, writable and executable only by the owner
rwxrw-r-- readable, writable and executable by the owner. Readable and writable by group members and readable by world.

Note that directories work just the same as files except that execution privilege represents the ability to move into the directory. If you do not give executable privileges to world and group, nobody can "cd" into the directory but you.

So the next obvious question is, how do you modify these permission fields? How do you change the permission bits, the owner and the user?

Previous | Next | Table of Contents