Permissions

chevy

Marvelous Da Vinci
Staff member
Mod
I would like to have a clear view of the file permissions strategy in Darwin. I find it very difficult to understand what group of file has what autorised access.
 
Permissions in Darwin are the same as for any other Unix. Each file has an owner and a group associated with it. It has 3 permission fields for owner, group, and others. The 3 fields are Read, Write and eXecute.
When you do an ls -l on your files you'll see something like this:

drwxr-xr-x 4 bp staff 136 Nov 3 18:35 Public
drwxr-xr-x 5 bp staff 170 Nov 3 18:35 Sites
drwxrwxrwx 47 bp staff 1598 Sep 7 12:49 perl

The first column is the permissions. The "d" designates a directory, the first three characters are the owner permissions. In this case, the owner "bp" has read, write, and execute for these files.
The second bunch of three characters is the group's permissions. For the group "staff" has permission to read and execute in public and sites, and to read, write and execute on perl. (perl is just my mucking-around with perl folder, and isn't used for anything serious)
The third trio of letters is the permissions applied to everyone else who can log in but isn't in the files owner or group.
There are a few other complications, but you won't have to worry about these in this "rough and ready" guide.

If you want to know about changing these from terminals and shell scripts then do a man chmod (also chown for changing owners). In Mac OS X you can do it from the info window, and their are some sensible limitations on what permissions you can assign, such as not letting others have more access than the file's owner.

Any standard Unix text can give you a good working knowledge of these permissions. What I've written here is enough to give you the basics, or as much as you'll need to know for most things.
 
Back
Top