无法从Ubuntu 14.04访问Mac OS X分区

我在Macbook Pro 6,2(2010年中)中有一个1 TB的硬盘驱动器,分区为Mac OS X为900 GB,Ubuntu 14.04为100 GB。 我希望能够在安装了OS X的HFS +分区中读取文件,以收听我的音乐,观看video文件等。

我通过登录我使用sudo权限创建的第二个帐户并运行以下(其中username是我的登录用户名)来更改我的Ubuntu帐户的UID:

sudo usermod -u 501 -g 20 username sudo chown -R username: /home/username 

当我重新登录时,我仍然得到“你没有必要的权限来查看’Macintosh HD’的内容。” 在我的故障排除工作中,我将主帐户的UID和GID更改回1000并创建了一个新用户帐户,我更改了UID和GID。 此帐户现在具有HFS +卷的读取权限 – 但是当我删除它并为我的主帐户执行完全相同的操作时,我得到了相同的错误。

是否可以更改我的主帐户的UID和GID,以便我可以读取HFS +卷?

编辑:这是我尝试访问文档时的问题的屏幕截图。 桌面,下载,Dropbox,Google云端硬盘,图书馆,电影,音乐和图片也会出现同样的错误 – 但不会出现任何其他(可见)文件夹。 没试过进入/.wine或其他任何东西。

这是该问题的屏幕截图。

编辑:根据Thomas W.的建议,我运行了sudo ls -al folder ,其中folder是放置Documents的文件夹。 这是输出:

 bzodonnell@bzodonnell-MacBookPro:~$ sudo ls -al /media/bzodonnell/MacOS/Users/bzodonnell total 232 drwxr-xr-x 1 501 dialout 61 May 4 15:57 . drwxr-xr-x 1 root 80 5 Oct 20 2014 .. drwxr-xr-x 1 501 dialout 20 Apr 7 13:11 adarkroom drwxr-xr-x 1 501 dialout 15 Mar 5 09:27 .android drwxr-xr-x 1 501 dialout 7 Mar 9 18:44 AndroidStudioProjects -rw-r--r-- 1 501 dialout 638 Feb 17 2014 .anyconnect drwxr-xr-x 1 501 dialout 90 May 5 11:48 Applications -rw------- 1 501 dialout 18776 May 5 16:56 .bash_history -rw-r--r-- 1 501 dialout 334 Oct 29 2014 .bash_profile -rw-r--r-- 1 501 dialout 167 Jul 10 2014 .bash_profile.pysave drwxr-xr-x 1 501 dialout 7 Apr 30 13:11 .cache drwxr-xr-x 1 501 dialout 156 May 2 13:13 Calibre Library -r-------- 1 501 dialout 7 Apr 4 11:10 .CFUserTextEncoding drwxr-xr-x 1 501 dialout 4 Mar 6 2014 .com.stirfirestudios.freedomfall.macos drwxr-xr-x 1 501 dialout 7 Apr 19 14:17 .config drwx------ 1 501 dialout 3 Sep 8 2010 .cups drwxr-x--- 1 501 dialout 6 Apr 15 15:12 .denemo-1.2.2 drwx------ 1 501 dialout 14 May 6 17:04 Desktop drwx------ 1 501 dialout 19 May 5 11:09 Documents drwx------ 1 501 dialout 207 May 5 15:13 Downloads drwx------ 1 501 dialout 12 May 7 08:16 .dropbox drwx------ 1 501 dialout 73 May 7 09:23 Dropbox -rw-r--r-- 1 501 dialout 22532 May 5 15:17 .DS_Store drwx------ 1 501 dialout 3 Apr 14 18:01 .emacs.d drwxr-xr-x 1 501 dialout 45 Apr 15 14:46 .fontconfig drwxr-xr-x 1 501 dialout 10 Apr 27 19:25 .git -rw-r--r-- 1 501 dialout 151 Apr 7 13:24 .gitconfig drwx------ 1 501 dialout 2 Apr 15 14:44 .gnome2 drwx------ 1 501 dialout 43 Jun 18 2014 Google Drive drwxr-xr-x 1 501 dialout 4 Feb 26 10:59 .gradle drwxr-xr-x 1 501 dialout 4 Oct 29 2014 .idlerc drwxr-xr-x 1 501 dialout 8 Apr 15 14:44 .inkscape-etc -rw------- 1 501 dialout 35 May 3 17:02 .lesshst drwx------ 1 501 dialout 71 Apr 4 11:10 Library drwxr-xr-x 1 501 dialout 9 Apr 15 15:12 .lilypond-fonts.cache-2 drwxr-xr-x 1 501 dialout 3 Feb 9 11:18 .local drwx------ 1 501 dialout 8 May 2 2011 Movies drwx------ 1 501 dialout 9 Feb 20 10:33 Music drwxrwxrwx 1 501 dialout 3 Jul 2 2014 .nchsoftware drwxr-xr-x 1 501 dialout 9 Apr 30 14:09 PCSX2 drwxr-xr-x 1 501 dialout 11 Apr 6 10:18 .pia_manager -rw-r--r-- 1 501 dialout 130030 May 7 09:54 .pia_manager_crash.log drwx------ 1 501 dialout 11 Apr 16 07:10 Pictures drwxr-xr-x 1 501 dialout 6 Jul 10 2013 Public drwxr-xr-x 1 501 dialout 6 Apr 15 23:39 .qgis2 drwxr-xr-x 1 501 dialout 3 Feb 20 2014 .R -rw-r--r-- 1 501 dialout 225 Dec 3 2013 .Rapp.history -rw-r--r-- 1 501 dialout 16419 Feb 9 14:02 .Rhistory -rw------- 1 501 dialout 1024 May 3 17:25 .rnd drwxr-xr-x 1 501 dialout 16 Feb 19 17:24 .rstudio-desktop drwxr-xr-x 1 501 dialout 6 Jul 3 2014 Sites drwxr-xr-x 1 501 dialout 8 Apr 15 13:45 stencylworks -rw-r--r-- 1 501 dialout 123 Apr 15 13:52 StencylWorks.prefs drwxr-xr-x 1 501 dialout 6 Jun 1 2012 .subversion drwxr-xr-x 1 501 dialout 4 Apr 14 22:31 .thumbnails drwx------ 1 501 dialout 25 May 6 16:59 .Trash -rw------- 1 501 dialout 849 Apr 14 18:00 .viminfo drwxr-xr-x 1 501 dialout 8 May 4 15:59 .wine drwxr-xr-x 1 501 dialout 10 May 3 19:51 .wine-brothers drwxr-xr-x 1 501 dialout 9 May 1 09:25 .wine-steam -rw------- 1 501 dialout 0 Apr 20 18:17 .Xauthority 

编辑:这是我正在键入的内容,以确保正确安装目录。 我在运行上面的代码之前输入了这个。

 bzodonnell@bzodonnell-MacBookPro:~$ sudo umount /dev/sda2 bzodonnell@bzodonnell-MacBookPro:~$ id uid=1000(bzodonnell) gid=1000(bzodonnell) groups=1000(bzodonnell),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),124(sambashare) bzodonnell@bzodonnell-MacBookPro:~$ sudo mount -t hfsplus -o uid=1000,gid=1000 /dev/sda2 /media/bzodonnell/MacOS mount: warning: /media/bzodonnell/MacOS seems to be mounted read-only. 

如果你已经离开并改变了你的uidgid ,那么现在就去更改它们,然后再回过这个答案的第一部分。

除非你真的知道你在做什么,否则你不应该只是为了安装驱动器来更改你的uidgid ,因为你可以破坏计算机中的其他权限,并可能无法访问Linux分区中你自己的主目录。


通常在挂载驱动器时,传递参数以提供uidgid作为挂载的选项,以指定用户/组所有权,以及其他重要的权限掩码参数和其他参数(这通常通过vfatntfs分区,但它适用于大多数分区类型,尤其是那些不尊重Linux权限系统的分区类型。 虽然这通常是作为特定分区或介质的持久性选项的/etc/fstab文件的一部分完成的,但如果您愿意,可以手动为给定的mount命令提供选项。

使用以下命令进行安装应该可以执行您需要的操作而无需修改您自己的用户的UID或GID。 这会在/media/username/创建一个MacOS文件夹,我们将驱动器分区安装到:

 sudo mkdir -R /media/username/MacOS sudo chown --recursive username:username /media/username sudo mount -t hfsplus -o uid=USERUID,gid=USERGID /dev/sdx /media/username/MacOS 

/dev/sdx替换为实际的分区标识符,以及具有用户名称的所有“username”实例。 同样,将USERIDUSERGID替换USERGID其中的实际值。

要使其永久保持用户可安装性,您应该添加一个允许用户安装和卸载驱动器的fstab条目,同时相应地提供uidgid

(注意: uidgid参数是从kernel.org文档中获得的。您必须具有必备库才能读取hfsplus分区以使其工作。)