I have a Ubuntu VM running in VirtualBox.
I have a Shared Folder set up as myshare I have a folder created in my home directory (~/jamesw) as host. using the line sudo mount -t vboxsf myshare host from my home directory in Terminal mounts the drive correctly, but if I reboot it is not mounted again.

This is a VM I use for running a simple web server and I would like this Share mounted each time I boot. Is there any way to do this? Especially given that it requires sudo?

4 Answers 4


Auto-mount shared folders using Virtual Box Manager

From Virtual Box > 4.0 we are able to auto mount shared folders in a virtual machine. To do so for Ubuntu we

  • need to install Guest Additions in the guest OS
  • make sure users are in group vboxsf
  • define shared folders from the Virtual Box Manager

Right click on your virtual machine and choose Settings->Shared Folders. This will list existing shares or lets you define a new shared folde by clicking on the blue folder icon with the green +-sign on the top right side:

enter image description here

Choose your folder from the dropdown menu Folder path or choose Define other for a file selector that lists the host filesystem. Choose a name for the share (e.g. myshares). By ticking Auto-mount this folder will always be mounted in the Ubuntu guest directory /media/sf_myshares (the prefix sf_ will automatically be added).

Alternatively, to define shared folders in a running guest OS we may select Devices -> Shared Folders from the window menu of Virtual Box Manager:

enter image description here

By ticking Make Permanent these shared folders will also be available on the next boot and will be mounted when Auto-mount is ticked in addition.

  • That will make the guest OS to automount a host share, and I believe the OP wants the opposite: to mount a guest share in his host OS. If i'm wrong, than I completely misunderstood the question, and my answer should be ignored
    – MestreLion
    Jul 8, 2011 at 21:52
  • 1
    @MestreLion: You are wrong, sorry! I think my problem is that I could never find the Shared drive on the Ubuntu VM because I had no idea it was mounting to /media. Had I realized that this question would not even have been necessary. Jul 9, 2011 at 3:35
  • @James: Oh, I'm sorry then. Mounting a host share in a guest OS is easy, and you have several options. Besides the (excellent, btw) answer given here, are you aware that a guest OS can be made seen in the LAN just like a regular machine? Just change network from the default NAT to Bridged. You can now "exchange" shares from guest to host (and vice-versa) using Nautilus, Samba, etc...
    – MestreLion
    Jul 9, 2011 at 8:26
  • @MestreLion: to be honest - I mostly share my host (and guest) files by using Samba over the network ;)
    – Takkat
    Jul 9, 2011 at 8:50
  • @Takkat: Me too! (and that makes both our answers obsolete! :P)
    – MestreLion
    Jul 9, 2011 at 9:08

I don't think use of /etc/fstab will work (it didn't work for me) because that file is processed before the SF module is loaded and will fail to mount the share, see HOWTO: Use Shared Folders 1.


This is not a complete answer yet, but more like guidelines on 2 approaches you have:

1 - You could edit /etc/fstab and add this mount there. You would need to translate your mount parameter to fstab syntax. A wild guess would be something like /home/jamesw/host vboxsf myshare,umask=002,uid=<youruser>,gid=plugdev 0 0. You would need sudoto edit your fstab, but, once done, it will be auto-mounted on boot. Since this is done before you even log in, you need an absolute path to the mount point (hence /home/jamesw/host), you can not use $HOME or ~. Hint: "host" folder don't need to exist. If it is in fstab, mount will create it for you.

2 - You could use fusermount instead of mount. The syntax is similar (but not identical, so you still need to translate the mount parameters). Fusermount requires your mount point to be somewhere inside your $HOME, but the biggest advantage is that you would not need sudo. And the mount will be avaliable in Nautilus (as if it was a CD or USB key). After you get the right parameters and test it, you can add it to your ~/.profile, which runs every time you log in.

EDIT: Im assuming that either Virtualbox dont need the machine to be actually runing for it to share folders, OR that it is up and running before you log in

  • Using /etc/fstab doesn't work, see Kenneth Gulbrandsøy's answer. Sep 15, 2015 at 13:19

Ubuntu 16.04 guest and shared folders automounting accessible by normal user

In order to automount and access those folders as normal user, specific steps are required.

  1. Don't use official guest additions. Instead install virtualbox-guest-dkms.

    sudo apt-get install -y virtualbox-guest-dkms
    sudo usermod -aG vboxsf $(whoami)
    sudo VBoxControl guestproperty set /VirtualBox/GuestAdd/SharedFolders/MountDir ~/vbshare
  2. Add some shared folders with Auto-mount and Permanent checked.

  3. Restart vm.
  4. Check if you have any vb folders mounted:

    mount | grep vboxsf

  5. If so, change ownership of ~/vbshare to yourself.

    sudo chown $(whoami):$(whoami) ~/vbshare

Add new shared folders without restarting VM

  1. Add shared folder.
  2. Check if you can find it listed by this command:

    sudo VBoxControl sharedfolder list

  3. If so, create directory and mount

    mkdir ~/vbshare/newfolder
    sudo mount -t vboxsf newfolder ~/vbshare/newfolder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.