在 Linux 中挂载 HFS+ 卷时绕过默认权限

ger*_*los 8 linux mac mount permissions hfs+

我有一台带有 Snow Leopard 和 Kubuntu 11.10 的双启动 macbook pro,并且想在运行 Kubuntu 时读取(不关心写入)我的主 Mac 主目录。

我可以毫无问题地挂载它,但是我在 Kubuntu 上的用户无法看到 mac 用户拥有的 HFS+ 上的文件,因为 uid 不同(Mac 上为 502,Kubuntu 上为 1000)。

查看有关 HFS+ 的内核文档,我读到:

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.
Run Code Online (Sandbox Code Playgroud)

所以我尝试使用这些选项:

$ sudo mount -t hfsplus -o uid=1000,gid=1000 /dev/sda2 /mnt/Mac
Run Code Online (Sandbox Code Playgroud)

但他们似乎什么也没做:当我使用 ls -l 环顾四周时,我仍然看到相同的权限。我可能遗漏了什么,有什么线索吗?

我知道我可以在 Ubuntu 上更改我的用户 ID 以将其与 Mac Os X 匹配,但如果可能,我更愿意避免它。

Cat*_*kul 12

bindfs是答案。它将采用一个已经安装的文件系统,并使用您想要的任何 uid 提供它的视图:

sudo apt-get install bindfs
mkdir ~/myUIDdiskFoo
sudo bindfs -u $(id -u) -g $(id -g) /media/diskFoo ~/myUIDdiskFoo
Run Code Online (Sandbox Code Playgroud)

编辑:

此外,阅读文档我意识到该map选项(1.10 及更高版本)可能更适合:

sudo bindfs --map=502/1000 /media/diskFoo ~/myUIDdiskFoo
Run Code Online (Sandbox Code Playgroud)