0

I am using 12.10 on virtualbox. I have my windows documents folder shared through virtual box folder share. Then I wanted to use mount --bind to mount my documents folder to the ubuntu user documents folder under ~/Documents

Here is the command I am using:

sudo mount --bind /media/D/Leinardo/Documents ~/Documents

When I do this however, I find that the ~/Documents folder now is owned by root and I do not have write access. Any ideas?

Thanks in advance.

2

Unselect the automount option in the virtual machine settings.

To mount the folder manually, run this on a terminal:

sudo mount -t vboxsf -o uid=1000,gid=1000 Documents /media/D/Leinardo/Documents

To mount it automatically, add this line to /etc/fstab:

Documents /media/D/Leinardo/Documents vboxsf uid=1000,gid=1000 0 0
  • In my case, adding the line to /etc/fstab fails the boot, probably because the command is executed too early. The error message in the logs is: /sbin/mount.vboxsf: mounting failed with the error: No such device. To solve that, I moved the mount command to /etc/rc.local, and even there I had to delay it a bit to avoid failure. The command looks like (sleep 5s && mount ...) &. In case you do that, don't forget to ensure that the service rc.local is enabled: sudo systemctl enable rc-local. – elboulangero Jan 6 '17 at 8:37
0

You should use a bind mount with the user/owner option. A bind mount does not take uid or gid.

The bind mount will apply the permissions from the user or owner directory to the mount.

The mount point should be owned by root. The user directory should be set up as desired.

Add this line to /etc/fstab:

/media/D/Leinardo/Documents Documents none bind,user 0 2

(Original reference) https://superuser.com/q/623375/179826

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.