Mount bind with full ownership and permissions

10,622

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
Share:
10,622

Related videos on Youtube

LeinardoSmtih
Author by

LeinardoSmtih

Updated on September 18, 2022

Comments

  • LeinardoSmtih
    LeinardoSmtih over 1 year

    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.

  • elboulangero
    elboulangero over 7 years
    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.