I'm using Windows and Virtualbox with RedHat, putting it simple: I've created a shared folder so I can use Eclipse on my Windows OS and do some testing in Linux.
However, I can't access the shared folder with my user, I've logged in with root and used chmod 777
and even moved my user to the folder's group.
Whatever I do the result is the same:
/media/sf_sharedFolder/: Permission denied
What can I do? How can I access the shared folder with my user?
For VirtualBox(5.0.24) Host=Mac(El Capitan) and Guest=RHEL(7.2)
Start up your RHEL Guest VM and open up a Terminal. Make sure you have the Developer Tools installed.
And the Kernel headers package so that the Guest Additions script can update your kernel.
Once you have the prereqs in place its time to install the Guest Additions. With your running VM selected go to the VirtualBox menu and select Devices --> Insert Guest Additions CD image...
Allow a few seconds for the mount to occur and the install script to kick off. Once they have click the "Run" button in the dialog that popped up in your Guest VM.
After the script finishes right click the CD Icon on the Desktop and choose Eject. Then Shutdown the Guest VM.
Create the Shared folder in you Host system using Terminal, I usually put it in my Documents folder, and make sure that your user can access it.
In the Oracle VM Virtual Box Manager select your VM and then click on the "Shared folders" configuration element. In the next dialog click on the Add Folder icon to the right of the Folders List.
Then in the popup window select the Host Folder you just created as the Folder Path and give it a Folder Name that will be used by the Guest VM, also tick the "Auto Mount" check-box.
After rebooting the Guest VM launch a terminal on the Host and check the user that is associated with the running VirtualBox Guest process is either your user, very likely, or in a group with access to the Shared folder.
Then as per several of the previous answers in a Terminal on the Guest VM add your user to the vboxsf group.
Log out and in again to pickup the change.
The shared folder should now be available and accessible as sf_rhelshared assuming you used the same names as I did in the popup window above.
After adding the user to the vboxsf group, you might need to completely log out of the gnome/xfce/??? session, because someone long ago decided that group affiliation should be cached at first login to the window system.
Or go old school:
in any shell you want to use to access the folder. Luckily, newgrp looks up the group list for itself and doesn't used the cached values. You'll still need to log out and back in to access the folder from something other than a shell.
The issue is that the shared folder's permissions are set to not allow symbolic links by default. You can enable them in a few easy steps.
Machine > Settings > General > Name
Try this (on the guest machine. i.e. the OS running in the Virtual box):
Now reboot the OS running in the virtual box.
For the truly lazy (no typing, only totally easy copy and paste):
Log out and back in to make the change active.
I know it's a "me too" solution, but I am truly lazy and didn't find any other solution to appeal my innate apathy... :)
Add yourself to the
vboxsf
group within the guest VM.Solution 1
Edit the file
/etc/group
. Look for the linevboxsf:x:999
and add at the end:yourusername
Solution 2
Run
sudo adduser $USER vboxsf
Either way, you should first log out and then log in after doing this for the change to take effect.