Wednesday, January 25, 2006

TIPS & TRICKS: Changing File Permissions in OS X

The other day, I was loading Microsoft Office 2004 onto a new Mac. I was using the drag-and-drop method of installing, since the launcher was not functioning properly. For a single user of the machine, this works fine. However, when additional users are introduced, problems of accessing the Office programs begin to arise.

When only one user is on the machine, the drag-and-drop method of installation is used, and another user is freshly created, then the programs seem to work. The problem is after a new user is introduced, installing (or reinstalling) Office, and this may be true for other programs installed using drag-and-drop, will only work for the user who installed it, since the folder assumes the permissions of the user who installed it.

Fortunately, harnessing the power of Unix in OS X can help you, as it did me. The first thing is that using the GUI interface (Get Info) to change permissions works fine for the read/write/execute permissions, but not at all for the ownership/groups. This is where the following Unix commands come into play using the OS X Terminal Window:

chown username filename
chgrp groupname filename

In both cases, the -R (for recursive or applies to all files/folders in or below this level) switch can be used immediately following the command and the filename can be enclosed in quotation marks (i.e. chown -R andrew "wordfile.txt").

If you don't ordinarily use the command line, this will sound foreign to you. Feel free to ask questions.

Updated 4/29/2006:

chmod is a command that modifies Read, Write, and Execute permissions for 3 categories of users. The categories of users are

1. User
2. Group
3. Others

And, the are always assigned in that order.

In the Unix world, Read, Write, and Execute permissions can be assigned with numeric values:

Read = 4
Write = 2
Execute = 1

Using these numerical values, permissions for each category of users can be assigned a total value that corresponds with each permission. For example, if we want the User to have Read, Write, and Execute; the Group to have Read, Write, and Execute; and Others to have Read only, the numerical value would be 774 (User = 4+2+1, Group = 4+2+1, Others = 4).

I.E. chmod -R 774 Microsoft\ Office\ 2004

No comments: