I have a Linux ext3 disk image that I downloaded on my Mac (running macOS Sierra 10.12.3). I also have a Linux VM (Ubuntu 16.04) running in VMWare (Fusion version 8.5.3) on the Mac. I'd like to mount this disk image in the Linux VM.

I've shared the folder on the Mac containing the disk image to the VM, and I can mount it using this command:

$ vmhgfs-fuse ".host:/$(vmware-hgfsclient)" ~/Shared

But when I try and mount a disk image in this directory, I get a permission denied error:

$ sudo mount -t ext3 -o loop ~/Shared/linux-ext3.img /mnt
mount: /home/dave/Shared/linux-ext3.img: failed to setup loop device: Permission denied

The same thing happens even if I try and mount it read-only:

$ sudo mount -t ext3 -o loop,ro ~/Shared/linux-ext3.img /mnt
mount: /home/dave/Shared/linux-ext3.img: failed to setup loop device: Permission denied

The shared directory is mounted read-write:

vmhgfs-fuse on /home/dave/Shared type fuse.vmhgfs-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

And the disk image file is readable and writable by all:

$ cd ~/Shared/
$ ls -lh linux-ext3.img 
-rw-rw-rw- 1 501 dialout 25G Feb  2 21:01 linux-ext3.img

So I don't understand why I am getting this error.

  • There are some tricky interactions with allow_root/allow_other in FUSE and actual root (and I always get confused by them, too). Try chmod o+rw linux-ext3.img – dirkt Feb 16 '17 at 9:56
  • @dirkt: Good call. I tried that, to no avail. Got the same "Permission denied" error. – Dave Dribin Feb 16 '17 at 15:28
  • Not familiar with vmhgfs-fuse: If it doesn't support chmod, try anything that would make the image readable to root: sudo vmhgfs-fuse ..., or make root a member of dialout, etc. Or, conversely, try mounting the image read-only. – dirkt Feb 16 '17 at 15:38
  • @dirkt: Ah! Thanks for the tip about "try anything that would make the image readable to root". I'll write up a proper answer, but it turns out vmhgfs-fuse disallows root access, by default. – Dave Dribin Feb 16 '17 at 16:12

Thanks to a tip by @dirkt above, I was able to determine that vmhgfs-fuse disallows root access, by default. From the vmhgfs-fuse --help output:

    -o allow_other         allow access to other users
    -o allow_root          allow access to root

Trying -o allow_root initially failed:

$ vmhgfs-fuse -o allow_root ".host:/$(vmware-hgfsclient)" ~/Shared
fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf

And, sure enough /etc/fuse.conf has user_allow_other commented out:

# Allow non-root users to specify the allow_other or allow_root mount options.

But running vmhgfs-fuse as root finally worked:

$ sudo vmhgfs-fuse -o allow_other ".host:/$(vmware-hgfsclient)" ~/Shared
$ sudo mount -t ext3 -o loop,ro ~/Shared/linux-ext3.img /mnt
$ ls /mnt/

Note the use of allow_other not allow_root. Using sudo plus -o allow_root is redundant, since vmhgfs-fuse only grants access to the user that runs the command. However sudo alone means only root can access ~/Shared, but not your regular user. Using sudo plus -o allow_other allows root and your regular user (and anyone else) to access ~/Shared. It might be safer, in a truly shared environment, to enable user_allow_other in /etc/fuse.conf so you could use -o allow_root and avoid running vmhgfs-fuse with sudo.

And, for the record, to unmount all of this:

$ sudo umount /mnt
$ sudo fusermount -u ~/Shared

Alternatively, I found out how to avoid mounting anything as root, using fuse-ext2. First, that needs to be installed:

$ sudo apt-get install fuseext2

And then mount it like this:

$ vmhgfs-fuse ".host:/$(vmware-hgfsclient)" ~/Shared
$ fuse-ext2 ~/Shared/linux-ext3.img ~/mnt/ -o ro
$ ls ~/mnt/

Note that this does not use sudo and it's only visible to your user. To unmount, use:

$ fusermount -u ~/mnt
$ fusermount -u ~/Shared

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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