VirtualBox Share Folder In Ubuntu Guest: Permission Denied

 ·  · 

Fix "Permission Denied" issue when trying to access VirtualBox share folder in guest OS.

 

1 Issue

I created an Ubuntu guest OS in VirtualBox and gave it a share folder from host. I was trying to open the share folder in Ubuntu guest but a "Permission Denied" error raised.

The share folder was mounted at /media/sf_share in my Ubuntu guest. So I tried to look at its permission in terminal:

$ cd /media/
$ ls -al

drwxrwx---   1 root vboxsf   sf_share

Obviously the owner of the share folder is root and the group it belongs to is vboxsf. But my current non-root user is not a member of vboxsf user group.

$ id MY_UESR_NAME

uid=1000(MY_UESR_NAME) gid=1000(MY_UESR_NAME) groups=1000(MY_UESR_NAME),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare)

 

2 Solution

The solution is quite simple: add current non-root user to the vboxsf user group.

$ sudo usermod -a -G vboxsf MY_USER_NAME

Double check the groups of current user:

$ id MY_UESR_NAME

uid=1000(MY_UESR_NAME) gid=1000(MY_UESR_NAME) groups=1000(MY_UESR_NAME),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),999(vboxsf)

Then logout and re-login, it will be OK to open and write the share folder in the guest OS.