Linux – By-passing default permissions when mounting HFS+ volumes in linux

hfs+linuxmacmountpermissions

I have a dual booting macbook pro with Snow Leopard and Kubuntu 11.10, and want to read (don't care about write) my home Mac home directory when I'm running Kubuntu.

I can mount it without any problems, but my user on Kubuntu on can't see the files on the HFS+ owned by the mac user, because of different uid (502 on Mac, 1000 on Kubuntu).

Looking at kernel docs about HFS+ I read that:

When mounting an HFSPlus filesystem, the following options are accepted:
[CUT]
    uid=n, gid=n
        Specifies the user/group that owns all files on the filesystem
        that have uninitialized permissions structures.
        Default:  user/group id of the mounting process.

So I tried using these options:

$ sudo mount -t hfsplus -o uid=1000,gid=1000 /dev/sda2 /mnt/Mac

But they seem doing nothing: I still see the same permissions when I look around using ls -l.
I may be missing something, any clue?

I know that I can change my user id on Ubuntu to match it with Mac Os X, but I'd prefer avoiding it if possible.

Best Answer

bindfs is the answer. It will take an already mounted file system and provide a view of it with whichever uid you'd like:

sudo apt-get install bindfs
mkdir ~/myUIDdiskFoo
sudo bindfs -u $(id -u) -g $(id -g) /media/diskFoo ~/myUIDdiskFoo

Edit:

Also, reading the doc I realized that the map option (1.10 and later) might fit better:

sudo bindfs --map=502/1000 /media/diskFoo ~/myUIDdiskFoo