Shared folder "permission denied" from Documents in a Mac VM
Getting "ls: reading directory '.': Permission denied" on a shared Mac folder in a Linux VM? Move the share out of Documents and Downloads, then mount it.
Updated 5 min read
On this page
You shared a Mac folder with a Linux VM, mounted it, and ls inside the guest prints this, even as root:
ls: reading directory '.': Permission deniedNewly created files may still be readable, which makes it more confusing. This page covers what is known about the error, how to move the share, how to check the mount, and what to send us if none of it helps.
Why it happens
The error comes from one report by a Multipass user (Multipass is a different VM tool, built on QEMU). Their shared ~/Documents subfolder failed to list in the guest, even as root, although newly created files could be read. They traced it to an Apple access control list (ACL) on some system folders such as ~/Documents, and moving the work folder out of Documents fixed it. A reply in the same thread said ~/Downloads is affected too.
That is a single report about another product, so it is evidence, not proof, for Hermitbox. We have not tested this for Hermitbox. Hermitbox shares folders through a virtio-fs share, and nothing in our documentation says whether ~/Documents or ~/Downloads fail the same way. Possible causes, most likely first:
| Cause | Symptom | Fix |
|---|---|---|
Folder is inside ~/Documents or ~/Downloads (ACL suspected) | Listing fails, even as root; new files readable | Share a folder elsewhere |
| Share not mounted, or VM started with no shared folders | Empty /mnt/mac or a mount error | Restart the VM, run the mount command |
| Shared folder was moved or deleted on the Mac | Folder flagged as missing in Hermitbox | Add the folder again |
| Something else | Error on a fresh folder outside Documents | Contact support (below) |
Fix 1: Share a folder outside Documents and Downloads
Before you start, you need a Linux VM and a folder in your home folder that is not inside Documents or Downloads. macOS guests mount shares differently; see Share folders and the clipboard.
- In Finder, create a new folder in your home folder, for example
Shared. - Copy the files you need into it.
- In Hermitbox, select the VM and show the inspector with View ▸ Show/Hide Inspector (
⌃⌘I), or the toolbar button. - Under Shared Folders, choose Add Folder… and pick the new folder. Dropping the folder from Finder onto the list also works.
- Find the old
~/Documentsfolder in the list and choose Stop Sharing. - In the guest, mount the share (Fix 2), then run
ls /mnt/mac.
Each folder you add appears under /mnt/mac in Linux. If the VM started with at least one shared folder, adding or removing folders applies live. If it started with none, the change applies the next time it starts.
Fix 2: Mount the share in Linux
Quick Linux VMs ("Ready in a Minute") already have the mount line in /etc/fstab. For other Linux VMs, open Mount in Linux under Shared Folders for copyable commands. To mount now:
sudo mkdir -p /mnt/mac && sudo mount -t virtiofs hermitbox /mnt/macThis creates the mount point and mounts the share. To undo it for this session:
sudo umount /mnt/macTo mount at every start, use the "Mount at every start" command in the same disclosure. It appends this line to /etc/fstab and mounts:
hermitbox /mnt/mac virtiofs rw,nofail 0 0To confirm the share is mounted, run this in the guest:
mount | grep virtiofsIt only lists matching mounts. No output means the share is not mounted, so go back to the mount command and read any error it prints.
Fix 3: Check whether the folder has an ACL
To see whether a folder carries an ACL, run this in Terminal on the Mac:
ls -led ~/DocumentsIt only reads and prints the folder's permissions. An ACL appears as numbered lines under the folder entry. Compare with your new folder:
ls -led ~/SharedIf the old folder shows ACL lines and the new one does not, that fits the report. It still does not prove the ACL is the cause in Hermitbox.
Fix 4: Check the share's settings and state
- Folder flagged as missing. Hermitbox marks shared folders that no longer exist. Add the folder again.
- Writes fail but reads work. Check whether Read only is ticked on the folder. Use Allow Writing to switch it off, or Make Read Only to switch it on.
- Share empty after adding it. If the VM had no shared folders when it started, restart it and mount again.
- Several folders. Each appears as its own subfolder under
/mnt/mac, so look one level down.
Checklist before you try again
- The shared folder is not inside
~/Documentsor~/Downloads. - The folder appears under Shared Folders and is not flagged as missing.
- The VM was restarted if it had no shared folders when it started.
- The mount command ran without errors and
/mnt/macexists. mount | grep virtiofsshows the share in the guest.- Read only is set the way you want.
If nothing works
If a new folder outside Documents and Downloads still fails, this is not the case from the report, and we have no documented cause. Contact support and include the Linux distribution and version, the path of the folder you shared, the output of mount | grep virtiofs in the guest, the output of ls -led for the folder on the Mac, and the exact error. A message you can copy:
Hermitbox shared folder: "ls: reading directory '.': Permission denied" in the Linux guest.
Distribution and version: (fill in)
Folder shared (path on the Mac): (fill in)
Mounted with: sudo mount -t virtiofs hermitbox /mnt/mac
Output of mount | grep virtiofs: (fill in)
Already tried: sharing a folder outside Documents/Downloads, restarting the VM.Common questions
Does this affect Hermitbox the same way as Multipass?
Unknown. The report was about Multipass, and we haven't confirmed it for Hermitbox's virtio-fs shares. Moving the folder is cheap, so try it first.
Can I make the share read only?
Yes. Tick Read only on the folder, or use Make Read Only and Allow Writing to switch modes.
The share is empty after I add a folder. Why?
If the VM had no shared folders when it started, the change applies at the next start. Restart it, then run the mount command again.
Do macOS guests have this problem?
We have no report of it. macOS guests see shared folders in My Shared Files rather than /mnt/mac; see Share folders and the clipboard.
Related: Permissions Hermitbox asks for and Troubleshooting Hermitbox.