On Jul 25, at 10:26 AM, Ward Oldham requested:

> Maybe you could elaborate on why someone would need or want to do
> something like this.


The chmod command in the command line is used to change the access  
permissions on a file or directory. It corresponds to changing the  
access privileges in the Ownership & Permissions when you're doing  
Get Info on a file, but there are permissions available to chmod that  
can't be done in the Get Info window.

At its simplest there are three types of permissions that can be set

read = permission to read a file or directory (folder in Macintoshish)
write = permission to change or even delete a file or directory
execute = permission to run a program or enter a directory

There are also three groups of users

user = the owner of the file (owner in Macintoshish)
group = the group ownership of the file
other = anybody else

Any combination of the permissions can be set for any of the three  
user types. You can see the permissions on a file by using ls in the  
terminal. Here's how:

First create a dummy file called test. The command "touch" creates an  
empty file.

[Sauron:~] lee% touch test

Then look at the default permissions

[Sauron:~] lee% ls -l test
-rw-r--r--   1 lee  staff  0 Jul 25 10:50 test

The "ls -l" command tells the terminal to list files in long form,  
which shows a whole bunch of information. I told it to just list the  
file test because the rest of the files are irrelevant. The first  
position will have a d, if the file is a directory, which it isn't,  
so just - is printed. The next nine positions give the permissions in  
the order user group other.

In this case -rw-r--r-- means

rw- user has read and write permission, but not execute permission
r-- group and other each only have read permission

Now, we get to chmod. Suppose I type

[Sauron:~] lee% chmod o+x test
[Sauron:~] lee% ls -l test
-rw-r--r-x   1 lee  staff  0 Jul 25 10:50 test

Now other has been given execute permission. Permissions can be  
removed just as easily:

[Sauron:~] lee% chmod g-r test
[Sauron:~] lee% ls -l test
-rw----r-x   1 lee  staff  0 Jul 25 10:50 test

Group members now have no permissions.

These are the infamous permissions that are being set when you  
"Repair Permissions" with a disk utility.

The original question was about permissions of the form 777. This is  
a conversion of the permissions given above from the binary number  
way they are actually stored to base ten; i.e.,

--x = 001 = 1
-w- = 010 = 2
r-- = 100 = 4

To get the numerical equivalent of the permissions, you just add up  
the numbers for the permissions that are present; e.g.,

rw- = 4+2 = 6

The permissions for all three are usually written something like

-rwxr-x--x = 751

So, the permissions 777 correspond to everyone having license to do  
anything at all to a file or directory, which usually isn't a good  
idea. It's usually better to think about what you actually need and  
restrict the permissions accordingly -- especially for a machine on  
the Internet.

The chmod command can do a lot more. Type "man chmod" into the  
terminal for all the options.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2452 bytes
Desc: not available
Url : 
http://www.math.louisville.edu/pipermail/macgroup/attachments/20070725/8a19412e/attachment.bin
 

Reply via email to