26

I installed Ubuntu guest on a Windows 7 machine using VirtualBox. How can share folders between Ubuntu guest and Windows host? Thanks.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • Possible Duplicate: http://askubuntu.com/q/30202/44179 – Seth Dec 18 '12 at 16:25
  • Have you tried the answer I provided here: http://askubuntu.com/questions/81757/shared-folder-virtualization-virtualbox . I can't test since I do not have a windows OS around. – Luis Alvarado Dec 18 '12 at 17:45
  • Please also have a look here for prerequisites: http://askubuntu.com/questions/30396/error-mounting-virtualbox-shared-folders-in-an-ubuntu-guest – Takkat Dec 18 '12 at 19:01

6 Answers6

16

If you get Permission denied when accessing the mounted shared folder, run the following command:

sudo adduser <yourUsername> vboxsf

Substitute <yourUsername> by your actual username (e.g. john or whichever is yours).

Then restart and you should have full access.

Melebius
  • 11,431
  • 9
  • 52
  • 78
11

run this on your terminal and everything is going to be fine:

sudo mkdir /media/(folder-name-on-linux)
sudo mount -t vboxsf (folder-name-set-on-virtualBox) /media/(folder-name-on-linux)

(folder-name-on-linux) will be available easily on your File Manager

PS: That way you won't need to restart your VM ;-)

sogurb
  • 111
  • This solved it for me. For any future travelers: you may need to run that second command everytime you restart the guest. Does this mean something else is broken? Probably... But it works for me when nothing else did. – isick Oct 23 '18 at 01:08
  • Works for a round. After reboot the sharing is gone. – Gustavo Aug 14 '19 at 13:06
6

Close out your guest VM, and then open up the Settings dialog for that VM. Down near the bottom of the left hand navigation area in that dialog should be an option for shared folders.

You can select which folder(s) on the host machine you want shared with that particular guest VM, whether you want them mounted read-only by the guest, and whether to make them available on boot of the VM. Once done, restart / restore the guest VM and you should be able to navigate to the new filesystem or folder.

I usually make a new folder inside the 'VirtualBox VMs' folder in my user directory, titled 'Shared' and then share that folder with any guest VMs that need it. I mount it read-only so that no one machine can b0rk it for the others, and then I can place any necessary files in there that are desired.

memilanuk
  • 533
  • Thanks for the answer. After restarting the guest VM, I opened the "Home" folder on Ubuntu(guest), but I still could not find the "shared" folder created and mounted. – user288609 Dec 18 '12 at 22:04
  • 1
    It is not normal to mount file systems under a user's /home; look for it in the file system. If it doesn't jump out at you in Nautilus (the file explorer app), it may be under /media/ or /mnt/. I'm not sitting in front of a box with Virtualbox on it at the moment so I can't be more specific than that for now. You may need to have Guest Additions installed on the guest VM - other distros like Debian and SuSE auto-install some version of them; Ubuntu does not. – memilanuk Dec 18 '12 at 22:39
2

you should make the option of "insert guest addition CD image" active, from the devices menu, in order to enable shared folder. the shared folder should appear in the /media.

mohamed
  • 21
1

Sharing folders between host and guest

  • Step 1

Extensions Pack

  1. Check if you already installed an extension pack or not?

Steps: Open VirtualBox ---> Click on File menu ---> Preferences (Ctrl+G) ---> Extensions tab

If you don't find any installed extension pack, go to the VirtualBox download page (https://www.virtualbox.org/wiki/Downloads) and look for Oracle VM VirtualBox Extension Pack, download and installed it.

(* Extension Pack must be the same version of your VirtualBox) [If you don't know what is your's VirtualBox version, just click on Help menu ---> About VirtualBox]

  • Step 2

Guest Addition

I. Start your Virtual Machine

II. Click on Devices ---> Insert Guest Addition CD image

III. After that, you will see Guest Addition dialog box

IV. Click on Run to start installing VirtualBox Guest Addition

V. Enter your account password and click on Authentication

[Alternative]

In case if you don't see Guest Addition dialog box, double click on VirtualBox Guest Addition CD image icon.

enter image description here

After that, you will see the cdrom0 folder opened. Right-click in that folder and choose Open In Terminal.

Type in the terminal sudo su and enter your account password. Use the ls command to show all files of the cdrom0 folder.

After that, type chmod +x VBoxLinuxAdditions.run command to change the permission of VBoxLinuxAdditions.run file.

At last, run the command sh ./VBoxLinuxAdditions.run to start installing VirtualBox Guest Addition

Now reboot your Virtual Machine.

  • Step 3

Start your Virtual Machine ---> Click on Devices menu ---> Shared Folders ---> Shared Folder Settings

Now click on Add Folder icon

enter image description here

Choose your Folder Path, Folder Name will be automatically selected. Put the checkmark on Auto-mount and Make-Permanent. Click on the OK button.

Now reboot again your Virtual Machine.

After reboot, you will find the Shared Folder on your desktop.

  • In case if you are unable to access the content of your Shared Folder, try those following steps.

Open your Terminal. Type sudo su then enter your password.

Write the following commands

sudo usermod -a -G vboxsf mir (* Instead of mir use your account name)

sudo chown -R your_account_name:users /media/your_share_folder_name/

Example sudo chown -R mir:users /media/sf_Linux_Application/

Now reboot your Virtual Machine and check the Shared Folder.

Mir Rahed Uddin
  • 619
  • 1
  • 8
  • 20
0

I had the same problem but after reading another question on this site, I discovered that running

gksudo nautilus

made it work fine.

Mark M.
  • 9
  • 5