Understanding a File’s Ownership and Permissions.

Many new Hackintosh users may not understand correctly why is so important Repair Ownership and File Permissions after install a kext (Kernel Extension) for example…

But what they probably don’t know, is the fact that kexts aren’t the only file types that needs proper Ownership and Permissions, and even worst, they don’t know that this may lead to a unbootable system…

For many reasons, including File System errors, I/O errors, etc…, the Ownership and Permissions of a file may not be correctly set, for example, during the creation of a Mac OS X installer or after a System Update, so, just as I described HERE, this is one more situation where even everything looking OK, you may be lead into some issues…

So, to understand better how all this works, keep the following in mind;

File Ownership: Every single System file must have its Owner and plus, this owner must have “full” control over the system, so, it must be owned by root (the account that by default have access over all files under a UNIX/based OS).

File Permissions: Every file must have its attributes, for example, if it’s meant to be only read or executed, so, based on this, we have the following attributes;

0  or  --- = No Permission

1  or  --x = Execute Permission

2  or  -w- = Write Permission

4  or  r-- = Read Permission

The information above + this nice image by Hurricane Labs will make you understand easily…

 photo unix-file-permissions_zps76af42b4.jpg

Group Permissions: The same as for File Permissions but applied to the User Group.

So, with all this in mind, let’s see what we can do to prevent/fix some specific issues…

1. Kernel Panics / Errors / Freezes during Mac OS X Installation or after a System Update.

First you’ll need to start the system in Single User Mode, use one of the options below;

A. Real Macs = Power On the computer while holding Command+S keys.
B. Hackintoshes = Add the boot flag -s to your boot loader.

By choosing any of the options above, you’ll see a screen similar to the image below;

Single User Mode

1a. Run the two commands below, each line at once followed by RETURN (Enter);

fsck -fy

mount -uw /

1b. Assure that you have no file permission issues by running the following commands, each line at once followed by RETURN (Enter);

NOTE: The asterisk (*) at the end of the command, briefly means “any file”.

chown -R root:wheel /System/Library/Extensions/*

chmod -R 755 /System/Library/Extensions/*

reboot

1c. Try to boot the Installer/System again.

2. Make sure to always have proper file permissions after handle system files.

Many Hackintoshers/OS X Users uses some kind of custom file, for example, custom fstab, custom startup scripts, custom plist (Property List), etc…, and this files may not work correctly without proper permissions…

Let’s use fstab as example, after create the file and move it to it’s proper location, you must set its permissions, do this by running the following commands, each line at once followed by RETURN (Enter) at Terminal.app;

NOTE: fstab must be owned by root and have 644 (-rw-r–r–) as file permissions.

sudo chown -R root:wheel /private/etc/fstab

sudo chmod -R 644 /private/etc/fstab

3. Use DiskUtility to repair file permissions at your OS X’s partition regularly.

This is the easiest way to have proper permissions to all system files…

Go to Applications > Utilities > Disk Utility, at the left panel select the disk where Mac OS X is installed, at the right panel select First Aid then click Repair Disk Permissions

 photo ScreenShot2014-10-04at61909PM_zpsb6b15b76.png

With this simple examples as base, you may be able to solve or prevent many possible issues…

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s