Mac Os X 10.4 Tiger (Visual Quickstart Guides)
Unix includes a command for setting file or directory permissions: chmod. Although this command can be a bit complicated, it is important. The security of your files and subdirectories depends on its proper usage. The chmod command uses the following syntax: chmod mode file ... The complex part of the chmod command is understanding what can go in the mode operand. This is where you specify the owner (also called user), group, and other (everyone else) permissions. You have two ways to do this: numerically and symbolically.
Numeric permission modes
Numeric permission modes uses numbers to represent permissions options. The best way to explain this is to provide an example. Remember, the nine characters of the permissions coding in a directory listing can be broken down into three sets of three:
Each character can be represented with an octal digit (a number between 0 and 7) by assigning values to the r, w, and x characters, like this:
So, if you want to give read and write permission for a file called file1 to the owner, that would be a 4 (read) plus a 2 (write), which adds up to a 6. You could then give read only permission to the group and others by assigning the value 4 (read). The command to do all this is chmod 644 file1. (The 644 permission is one you'll see often on text files that are readable by everyone. A permission of 600 would make a file private.) Symbolic permission modes
Symbolic permission modes enables you to add or remove privileges using symbols. For example, to remove write permission from the group and others, type chmod go-w file1. This translates to "take away write permissions from the group and others." The ownership symbols you use for this are:
The symbols for the permissions you can add or take away are:
Finally, the operations you can perform are:
You can combine more than one symbol in a mode and more than one "equation" if you separate them with commas. For example, chmod a+;rwx,o-w file1 gives universal read, write, and execute access to all and then takes away write permission from others to file1. (The equivalent numerical permission would be 775.) To change the permissions for a file or directory
In the Terminal window, type chmod mode file ... (for example, chmod 644 file1) and press
|