Resources & Services: Computing
Understanding Permissions
Mac OS X uses Unix style file permissions to control access to files. I you are having problems editing or viewing a file, it may be related to a file permission issue. You can also use permissions to protect your files from being altered by other users.
Who You Are
In the Unix world you are one on three people - owners, group members and everyone else. If you are the owner of a particular file/folder you have full control over that file/folder, but you can limit what other members of your group can do with this file. All users are also members of at least one group.
Reading Permissions
The first thing to understand permissions is to understand how to read permissions. From a command line typing ls -la would display a list of all the files in the current folder, with their permissions. Here is an example
|
There are 4 groupings of characters that tell you information in the permissions.
|
||||||||||||||||||||
The first character identifies the entry. It will be set to one of the following settings:
d = Directory
l = Link
- = File
The next 3 sets of 3 characters correspond to the three types of users on the system (Owner, Group, Other). In each set there is a read (r), write (w), and a execute (x) setting.
r = Read, allows users to open and view a file/directory
w = Write, allows users to edit the file/directory
x = Execute, allows users to run an executable file
From the example above, you can see that file1.txt has its permissions set to:
-rw-rw-r--
This means the the owner (user) and group (course101) members can read and write to this file, Other users may only read the file.
Changing Permissions
When changing permissions on a file from a command prompt you will need to use the command chmod. The syntax for writing this command is this:
chmod -R 777 documents
This command would set the permissions on all the files/folders contained within the folder "documents" to full permissions for everyone (rwxrwxrwx).
The -R flag makes the command recursive
The 777 tells the command what permissions to apply to each group (7 for Owner, 7 for Group and 7 for Others). Here is how we came up with these values
|
These values can be combined to create any combination of permissions, as shown here.
|
Samples
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
You can view a more detailed article regarding permissions at OSX faq.
