I have a 1 TB hard drive in a Macbook Pro 6,2 (mid-2010) partitioned with 900 GB for Mac OS X and 100 GB for Ubuntu 14.04. I would like to be able to read the files off the HFS+ partition with OS X installed to listen to my music, watch video files, etc.

I changed my Ubuntu account's UID by logging into a second account I created with sudo privileges and running the following (where username is my login username):

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

When I logged back in, I still got the "You do not have the permissions necessary to view the contents of 'Macintosh HD'." In my troubleshooting efforts, I changed my primary account's UID and GID back to 1000 and made a new user account on which I changed the UID and GID. This account now has read access of the HFS+ volume - but when I deleted it and did the exact same thing for my primary account, I got the same error.

Is it possible to change the UID and GID of my primary account to give me access to read the HFS+ volume?

EDIT: Here's a screenshot of the issue when I try to access Documents. The same error occurs for Desktop, Downloads, Dropbox, Google Drive, Library, Movies, Music, and Pictures - but not any of the other (visible) folders. Haven't tried to get into /.wine or anything.

Here's a screenshot of the issue.

EDIT: Per Thomas W.'s suggestion, I ran sudo ls -al folder, where folder is the folder in which Documents is placed. This is the output:

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

EDIT: Here's what I'm typing to make sure the directory is mounted properly. I typed this before I ran the above code.

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.
  • I don't know if you have the answer yet or not. I pulled my drive out of my MacBook Pro, and I am able to access my drive without having the hfsplus installed in my Ubuntu, and the drive is formatted as HFS+. However, I am not able to access any of the folders in my /home/username area unless I launch my Nautilus as an elevated user. Try typing in from a terminal window sudo nautilus and then see if you can access the contents of that drive. – Terrance May 6 '15 at 4:39
  • @Terrance Are you talking about an external hard drive formatted HFS+? I suspect my issue is related to the fact that the HFS+ partition in question is my boot drive for OS X. – bzodonnell May 6 '15 at 4:58
  • It is external right now. It did, however, only mount it as read only. It does that to protect the files. I can read any files from within any of the folders though. I just unmounted it, and remounted it using the command mount -t auto /dev/sdh2 /media/OSX/ where sdh2 is the partition that the HFS+ is. It mounts it as read only. You can run blkid from a terminal window to show what all the partitions are formatted as and what their /dev/sdX designations are. – Terrance May 6 '15 at 5:05
  • I think you may have commented on the wrong one. You need to unmount the partition first sudo umount /dev/sda2, then try the command. – Terrance May 6 '15 at 5:33
  • Oh, I posted it down there because I was responding to the mount command he suggested in his post. Now, I can mount the drive in /media/bzodonnell/MacOS, and I can see the folders, but I can't get to anything within the /Users/username directory of the MacOS drive. Probably means the chown command terminated early. A related question on that, though: does chown from Ubuntu modify the actual permissions on the Mac OS X partition, or just the access that Ubuntu has to the existing files? In other words, could chown cause problems for my OS X installation? – bzodonnell May 6 '15 at 6:06

If you have gone and changed your uid and gid, go and change them back now before even going past this first part of this answer.

Unless you really know what you're doing, you should NEVER go change your uid or gid just to mount a drive, as you can break other permissions in the computer and potentially lose access to your own home directory in the Linux partition.

Usually when you mount a drive, you pass arguments to provide the uid and gid as options for the mount to specify user/group ownership, as well as other important permission mask arguments, and other arguments (this is most typically done with vfat or ntfs partitions, but it applies to most partition types, especially ones which don't respect the Linux permissions systems). While this is usually done as part of the /etc/fstab file for persistent options for specific partitions or media, you can manually provide options for a given mount command if you wish.

Mounting with the following command should do what you need it to do without modifying your own user's UID or GID. This makes a MacOS folder in /media/username/, where we'll mount the drive partition to:

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

Replace /dev/sdx with the actual partition identifier, and all instances of 'username' with the user's name. Similarly, replace USERID and USERGID with the actual values there.

To make it persistently user mountable, you should add an fstab entry that allows users to mount and unmount the drive, while providing the uid and gid accordingly.

(Note: the uid and gid arguments were obtained from kernel.org documentation. You must have the prerequisite libraries to read hfsplus partitions to make this work.)

  • Thank you! Just a few clarification questions: 1) When I type sudo mkdir -R /media/username/MacOS (replacing my username, of course), I get that R is an invalid option. 2) When replacing USERID and USERGID, am I replacing with the UID and GID for my Ubuntu user (both 1000), or for my Mac user (501 and 20)? I assume it'd be the mac ones, but I just want to check. Also, how easy is it for me to break permissions by changing uid and gid? I've barely used Ubuntu (just installed it today, actually). Would it be best for me to do a clean install, or is it probably fine if I made sure to use chown? – bzodonnell May 6 '15 at 4:18
  • (1) This is to be run on your Ubuntu partition. Try -p instead. (2) UID and GID are for the Ubuntu user not the Mac user - this says you want the system to mount with UID/GID for Ubuntu. Mac is evil with perms though. Read the man page for mount options and learn what they do. (3) As long as you change your uid and gid back to what they were breakage should be minimal. If you are really concerned then do a fresh Ubuntu reinstall. It's insanely easy to break permissions if the wrong uid or gid is set which is why I put so much emphasis to my warning at the beginning of my answer. – Thomas Ward May 6 '15 at 4:26
  • @bzodonnell See my previous comment for the answer to your follow ups. – Thomas Ward May 6 '15 at 4:28
  • Yeah, thanks; much appreciated. I suspect the breakage was minimal, since all I did was change the permissions, realize it didn't work, and change them back. I used chown on my (empty) home folder each time, so I'm probably fine. Running the chown command on the media folder now. Will let you know if I have any more questions after it ends. – bzodonnell May 6 '15 at 4:38
  • Running the chown command gave me access to most folders on the Mac partition, but I still get a "This location could not be displayed" error when trying to access Desktop, Documents, Downloads, Library, Movies, Music, or Pictures. Is there another chown command I'd have to do to get access to these folders? – bzodonnell May 6 '15 at 7:04

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.