Nov 222007
 

Accessing your OS X home from GNU/Linux

To have complete access to your OS X home you need to have the same uid and gid ib both Linux and OS X.

Usually OS X assigns uid starting from 501, while (k)ubuntu assigns uid and gid starting from 1000. OS X gives the group staff (with gid 20) to all users.

Change your uid in OS X is quite simpe, but befor to do any change it is better create a new user with administrative rights, to be sure to be able to log in and administer your mac.

Log in with your normal account and open a shell and give the command:

sudo bash

and give your password at the prompt.

Now open your control panel, click on Users and right click over your login name. Click on advanced options and you will be able to change your uid.

Now if you will not be able to do anything in your shell don’t panic. Log out and login with the alternate user you created before.

Open a shell and type: sudo bash

Your id is changed, but you have to change your gid too. (This is not essential, but i feel better with a group for me instead than staying in the staff group)

So you have to create a new group with the same id of the group you have in Linux. Usually in Linux you have the same uid and gid. For example uid=1000 and gid=1000 and you belong to a group with the same name of your login.

If your login is gandalf and your id is 1000 usually you beolong to a group with name gandalf and gid=1000.

So you have to create a new group in OS X with name gandalf and gid=1000.

Type in the shell:

dseditgroup -o create -i 1000 -n . gandalf

when the group is created you have to add your user to the group

dscl . -append /Groups/gandalf GroupMembership gandalf

now your user has the same id of the linux user and belongs to a group with the same name and id, but your home directory in OS X still belongs to someone with the old id so you have to go to /Users and change the owner of directory. In the shell type:

cd /Users

chown -R gandalf:gandalf gandalf

So your home directory has the right owner.

Now you should be able to logout and login with your normal user and everything should work right.

Restart and boot in Linux, you should be able to read and write in your OS X home directory as in your Linux home.

The following trick could be potentially danegerous, expecially if your mac partition is journaled.

I did this in my mac and till now it works fine, but be careful.

I used OS X for some months before installing Linux so I have a lot of email saved in Thunderbird in OS X and a lot of bookmarks and saved password in Firefox, and overall I want to be able to switch between Linux and OS X and continue using Thunderbird and Firefox with all my downloaded emails etc.

Open a shell and go in your home directory. Type:

ln -s /media/mac/Users/gandalf/Library/Thunderbird/ .mozilla-thunderbird

cd .mozilla

ln -s /media/mac/Users/gandalf/Library/Application\ Support/Firefox/ firefox

 

 Posted by at 23:26 - 018