View Single Post
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2005-02-02, 21:07

Quote:
Originally Posted by fightclub
I like to keep my computer organized with different folders for different purposes and even different partitions for different purposes. I was reading a review of OSX on anandtech where the author says that you should keep everything in the 'home' directory because it makes it simpler.
Something you need to keep in mind is that Mac OS X is organized quite differently than Windows. These are two entirely different beasts. Oh, where to start?

First of all, let's take a look at the overall "user" structure and permissions on Mac OS X.

There are basically two types of users on Mac OS X. Regular users and administrator users. This is similar to how Windows handles things, but I believe Mac OS X keeps a tighter reign on what goes on under the users.

By default, regular users have write access only to their home folder. They simply cannot modify things anywhere else in the drive. This is to keep them from wreaking havoc on the system files, applications, and user data that doesn't belong to them. If regular users want to change the contents of something out of their reach like the /Applications folder, they are presented with a dialog to "authenticate" as an administrative user.

Also, keep in mind that this prevents errant processes (worms, trojans, etc.) from being installed in the system. Of course, there isn't any such malware for Mac OS X and that's at least partly because of this security.

Administrative users, on the other hand, have a little more free reign over things. These users belong to the "admin" user group (more on this later) which has write access to a few additional things such as /Library and /Applications. This does not, however, give them explicit access to other users' files or the /System folder. Again, this is to protect people from being stupid. If you want to modify something as an admin users for which you don't explicitly have permission, you must authenticate for each action. This may seem like a burden, but it really is not because it will be very rare that you'll need to change something that doesn't belong to you.

Let me touch back on this "user group" thing I mentioned above.

In a nutshell, every file and folder in Mac OS X has nine basic attributes. There are three settings for three user categories. The user categories are:
  • owner
  • group
  • everyone
And the three settings for each of these are:
  • writable
  • readable
  • executable
If you have used Linux for any short period of time, these should be very familiar to you.

What's the point here? Security. Your ~/Documents folder, for example, is readable by you (the owner) but not by anyone else. You can have things that you can read and write but others can only read (like protecting shared documents), things that are writable but not readable by everyone else (like a drop box), and several other combinations.

The "group" category is there so you can apply special permissions to more than just one specific user. The /Applications folder that I mentioned above gives the "admin" group write access.

Now that you should understand users, groups, and permissions, let's think about security in a more general sense.

Yes, as an admin user you can technically put files anywhere you want on your computer. You can even modify the permissions so anyone can write to anything, but that doesn't make a whole lot of sense from a security standpoint. This permissions system is the whole reason people clamor about Mac OS X being so secure. Take that away and you might as well be running Windows 3.1 with no security infrastructure at all. Not smart.

Of course, Mac OS X in a more general sense encourages you to keep your personal files tucked into the existing structure of your home folder. You'll find that some applications are hardwired to look for things in you home folder or will save things there by default. The default location for open and save dialogs is your home Documents folder.

Before I shut up, I'll point out one feature that truly epitomizes the logical way Mac OS X is structured. Library. What's this? Well, Library is the name of a folder, several folders actually. There are three important ones I'll discuss:
  • /Library
  • /System/Library
  • ~/Library
The Library folders are where your applications keep their settings and support files. This is where you'll find preferences, fonts, caches, databases, scripts, and just about any files that you don't explicitly save yourself. So, why are there three of them? Three words: permissions and inheritance.

/System/Library is not writable by anyone. This contains files that belong to the system and that apply to everything everywhere. This includes the default system frameworks and libraries.

/Library is stored at the top level of your hard drive. It is only writable by admin users. You would store in there files that you want to apply to everything. For example, if you put a font in here, all users will have access to it in their software. If you put a screen saver here, all users will be able to select and use it.

~/Library is located in your home folder (the ~ is unix shorthand for your home, as SonOfSylvanus mentioned). Each user has one and it is only accessible by that specific user. Files you place here will apply only to you (or a given user). If you put a font here, only you will have access to it.

Why did I go to the trouble of explaining the Library hierarchy? It's because this is an excellent example of how Mac OS X is logically organized. It may seem a little weird at first, but you will soon come to greatly appreciate it. Stick to the default organizing principles and it'll make your life a lot easier. This includes using your home directory for your own things.

*whew!*

The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting.
  quote