I've created a shared folder in VirtualBox and made it mount under Ubuntu; I see it in the /media/ dir, but when I'm trying to list it I'm getting a "No permission" error message. How can I fix that?
4 Answers
Add your user to the vboxsf group:
sudo usermod -aG vboxsf $(whoami)
sudo reboot
-
3You shouldn't need to reboot. You should be able to just log out and log back in to reload your permissions. Apr 24, 2016 at 14:52
By default Virtual Box shared folders are created with read/write permission for the guest. This can be done from the command line with:
VBoxManage sharedfolder add "VM name" --name "sharename" --hostpath "C:\test"
By adding the option --readonly
we can restrict these for read only access. Use the --transient
option if you only want the shares to appear in the present session but not persistent for follwing sessions. There are some limitations for shared folders (see this question for details). If prerequisites are met we may mount these shared folders manually by running the following commands in the guest:
mkdir /home/<user>/vboxshare
sudo mount -t vboxsf -o uid=1000,gid=1000 share /home/<user>/vboxshare
Of course we can also use different mount options to mount as read/only
or mount with read access only to root.
Open your Virtual Machine's Terminal. Type sudo su
then enter your password.
Write the following commands
sudo usermod -a -G vboxsf your_account_name
sudo chown -R your_account_name:users /media/your_share_folder_name/
Example sudo usermod -a -G vboxsf mir
Example sudo chown -R mir:users /media/sf_Shared_folder/
Now reboot your Virtual Machine and check the shared folder again
Please make sure you have the same version of Virtualbox Guest Additions installed on the Guest machine as of Virtualbox on Host machine.