0

I created shared folder in Windows and linked it to Ubuntu through VM settings-Shared Folder-Added path-name.

Now this shared folder is not accessible when I start the ubuntu OS. I added my username to the vboxsf group and restarted guest OS, tried logging out-logging back in but the problem persists.

How to resolve the issue? I am getting access denied on ubuntu.

11
  • @N0rbert : No. I tried all of the options given in the link you provided. It's still saying access denied. And if I am manually mounting the guest folder, I can access the folder but it's not showing any bidirectional changes between host and guest shared folder.
    – learner57
    Mar 5, 2022 at 19:29
  • removed my answer after seeing Norbert's comment... mine was somewhat similar to the first one on that page except that I am using /etc/fstab to auto-mount and I am explicitly declaring the options... FYI, my user is not a member of vboxsf. Who is the owner of the mount point-unmounted? Who is the owner of the directory and files when mounted?
    – WU-TANG
    Mar 6, 2022 at 1:50
  • Have you installed the guest additions? Mar 6, 2022 at 14:47
  • @ChanganAuto yes, see this imgur.com/a/iVBFlr5
    – learner57
    Mar 7, 2022 at 7:48
  • @WU-TANG root is the owner of the sf_sharedfolder. Hence it says permission denied. I tried to change permissions by using chown 777 and i was able to access the folder but the changes were not being reflected between windows folder and ubuntu folder
    – learner57
    Mar 7, 2022 at 7:50

2 Answers 2

0

I mount my shared folder in /etc/fstab like:

sharedsfname /files vboxsf rw,noexec,auto,nouser,uid=1000,gid=1000 0 0


The uid/gid=userid option is the key in my case... Without it I have the same issue that you are experiencing.

I have a linux on linux setup though, so I am not sure about the effects with a Windows host.

In my example

  • I am creating my shared folder and checking 'make permanent' (always clicking OK, to accept the changes)

  • I am creating my own folder on my guest called /files.... owned and r/w by my user.

  • Using the shared folder name (NOT THE AUTO-NAME mount point, created by virtualbox?: sf_XXXXXXXX), This is the name that you designated in the virtualbox GUI on the host(it also gets auto-created but it is an editable field in the Shared Folders editor)... you can also get this name from sudo VBoxControl sharedfolder list on the guest. Mine is called sharedsfname.

  • Adding a line (above) to /etc/fstab, designating the share sharedsfsname, the mount point /files, and the filesystem type vboxsf, along with some options... most importantly the uid=1000 and the gid=1000. Those are the id of my user.

  • After that, you should be able to mount the drive by typing sudo mount -a. Or by rebooting... The auto option ensures mounting on startup.

Virtualbox wanted you to be able to effectively do the same thing in its GUI, and for the most part you can. In the Shared Folders editor I can designate the (host's) share name and I can also give a path for the mount point of directory you wish to use as a mount point on the guest, like /home/wu-tang/data... it will mount your share if the /home/wu-tang/data exists.... or it will create /home/wu-tang/data and mount your share... On my system it gives the mount point ownership of root and the group of vboxsf (root:vboxsf). In this case you will need to add your user to the vboxsf group and have access. (Which is why I prefer the previous mentioned method instead because you are simply giving ownership to your user without any additional alterations). But as soon as you exit the editor, the mount seems to happen on the guest. I could not see any options using VBoxmanage to create the share on the command line with specific permissions/ownership to avoid the extra permissions related steps.

minor frivolous rant here... Another thing I just discovered that I don't like, is that it will create these folders if they don't exist, REGARDLESS of where you tell them. Be careful, the user is running the virtualbox manager and is able to create directories on the root partition of the guest. I created a second varlog directory on the guest / and it did not allow the virtualbox host to designate it as a mount point, so there 'seems' to be some safety built in there. Though the host's user would technically be trashing the user's VM, if things went wrong, so logically, it is not that alarming.

4
  • Thank you so much for the response and write up. I might be a real naive here, can you please tell me step by step instructions to follow. 1. Create an empty folder on Windows. 2. ??
    – learner57
    Mar 10, 2022 at 16:38
  • 1 is create a share. 2 would be create a folder on the guest, ubuntu. I am confused again, In your very first comment you said that nothing on @N0rbert's link worked? The first answer on his link is basically what I am telling you to do. Did you really try that one? Attempt it again, you don't have to do the "VBoxManage" command(that just makes a share, you already made one). Just the following two commands. My answer does the same thing but just makes it permanent, which is why I removed it when I saw his link. Basically the answer is to not use the /media/sf_xxyyzz folders as mount points
    – WU-TANG
    Mar 11, 2022 at 1:04
  • do not create the folder/mount point as root. Do not use sudo for that... Do it the way it is provided in the aforementioned link. it is not necessary and will make it more difficult to deal with. Ensure you have full ownership and permissions on the created folder. If you need help with the share name, then look at my 3rd step in my answer.
    – WU-TANG
    Mar 11, 2022 at 1:23
  • Thank you @WU-TANG for helping me out! I was able to achieve my goal. I re-installed VirtualBox Guest Additions to give it a fresh start. And it worked. See imgur.com/a/J9zkGvS Now the group is showing as vboxsf instead of root
    – learner57
    Mar 11, 2022 at 18:49
0

Situation: https://i.stack.imgur.com/pHFKy.jpg Can't access shared folder between Windows Host and Guest Ubuntu on VirtualBox

Troubleshooting : The problem was in VirtualBox Guest Additions.

Solution: I followed these steps:

  1. Fresh VirtualBox Guest Additions installation.
  2. When Ubuntu rebooted, I checked if my username was in the vboxsf group by checking entry in cat /etc/group (It was already present)
  3. I created a new folder vboxshare on windows host.
  4. On VirtualBox settings -> Shared Folder, I added the path to vboxshare on "Add Share" window and checked "Auto Mount"
  5. I booted the Ubuntu guest machine. Now I was able to access the sf_vboxshare folder under /media/ and the vboxshare folder on Windows Host and Ubuntu Guest are now in sync!

Result: https://i.stack.imgur.com/pKBed.jpg

1
  • good find... good to know that Guest Additions causes the problem (or that reinstalling Guest Additions triggered some other fix action)... Makes me wonder if you were running an old version of Guest Additions and now you've upgraded? I still prefer having my user actually own the folder and avoiding /media/sf_folders.
    – WU-TANG
    Mar 12, 2022 at 2:00

Not the answer you're looking for? Browse other questions tagged .