38

I have an Ubuntu 12.04 machine on which I have installed VirtualBox with Ubuntu 12.04 as the guest OS.

How can I share files between the host and guest?

I have installed the guest additions also but still it’s not able to mount the sf_shared folders if even it’s mounted. This means I'm unable to retrieve the file from the host.

Melebius
  • 11,431
  • 9
  • 52
  • 78
prabha
  • 391
  • 1
  • 3
  • 3
  • also see: http://askubuntu.com/questions/30396/error-mounting-virtualbox-shared-folders-in-an-ubuntu-guest - but I recommend to use Ubuntu's inbuilt file sharing through the virtual network. – Takkat Oct 27 '13 at 19:22
  • @EricCarvalho It does seem like one of these should be made a duplicate of the other. The titles can be edited if necessary, since there aren't that many differences between Ubuntu and other hosts for this. Either way, answers of the closed questions can be merged into the other, especially if there's concern about them being obscured or (less likely) someday deleted. This one has far more views, but for most people I suspect the answer on the other one might be the most valuable. – Eliah Kagan Sep 05 '17 at 23:44

5 Answers5

45

I do not believe its possible to share files between the host and the guest without installing the extension pack first though I could be wrong on this.

You can find that here: https://www.virtualbox.org/wiki/Downloads

Check that the version of Virtualbox you have. Mine is 4.2.18 and double click the link

You should see something like this

enter image description here

Click OK and let it install.

Next step create a folder on your host machine as as share area

I've created one called VboxShare in my home directory.

enter image description here

First, make sure that your virtual machine is powered off.

machine-state-powered-off-image

Then, go into settings for your virtual machine, select shared folders then the plus icon to create a shared folder and fill in the details set it to auto mount.

enter image description here

Click OK then start your guest.

Job Done the shared folder appears on you guest machine as

/media/sf_Vboxshare

enter image description here

There is only one more step add any user in your guest system that needs access to the folder to the group vboxsf:

sudo adduser $USER vboxsf

Log out and back in, everything should work fine now.

Shon
  • 103
Warren Hill
  • 22,112
  • 28
  • 68
  • 88
  • @Richard: can you explain your comment? Are you saying sudo adduser $USER vboxsf doesn't work or that sudo useradd -g $USER vboxsf is somehow preferable? – User Dec 01 '14 at 05:53
  • This last command to adduser, is that done on the host machine or on the guest machine? Looks like it should be done on the guest machine because $USER means someone else on the host machine, but just checking. All my commands succeed but I still don't see anything in the shared folder on the guest machine. – Reb.Cabin Jun 23 '15 at 12:27
  • @Reb.Cabin it says in the answer this is on the guest machine you also need to log out and back in again on the guest machine. – Warren Hill Jun 23 '15 at 15:16
  • @WarrenHill that did it, tyvm. – Reb.Cabin Jun 23 '15 at 15:20
10

On the VM settings in the Shared folders section, remember the name of your shared forlder!
After installing the VBox Guest additions on the guest OS fire up a terminal and type in

sudo mount -t vboxsf <share-name> /where/to/share

may wanna check https://forums.virtualbox.org/viewtopic.php?f=3&t=15868

3

Go to Devices option of your VM and click on the Shared Folders option and add the required_folder you want to share. Now in your file system (root) you can see media/sf_required_folder. But by default the Guest User won't have access to this folder. So to grant access to this folder you need to add Guest user to the group vboxsf. For this, sudo adduser Guest_user vboxsf to give access. Now have the access.

AJ.
  • 131
  • 2
3

If you want to share files and folders you can use Vbox extensions as mentioned in other posts.

Alternatively you can use Nitroshare :

  1. Install Nitroshare (in host and in guest )

    sudo add-apt-repository ppa:george-edison55/nitroshare
    sudo apt-get update
    sudo apt-get install nitroshare
    

    There are four ways to install Nitroshare - reference : here

  2. Start Nitroshare (in guest and host) from the dash or from a terminal command nitroshare

    You will see the tray icon on top right corner :

    Imgur

  3. By default the destination folder is ~/Desktop. You can modify it in settings.

    Imgur

  4. Sending files and folders:

    Select _send files/Directory _ from the tray icon, select the file /directory you want to share, click on open.

    Then select the VM device from the menu and click OK.

    Imgur

cl-netbox
  • 31,163
  • 7
  • 94
  • 131
Ravan
  • 9,379
1

Try this combo. I used this as I am using AMD64 CPU.

virtualbox-4.3_4.3.6-91406~Ubuntu~precise_amd64 with extenstion pack -
Oracle_VM_VirtualBox_Extension_Pack-4.3.6-91406

It works. Also Make sure

After installing the VBox Guest additions on the guest OS (VM) fire up a terminal on Guest server and type in

mount -t vboxsf  /shared-name /where/to/share

Example

sudo mount -t vboxsf /home/myshare /mnt

where /home/myshare is a folder on Host Server and /mnt is a folder on guest server.

Start dumping files on host folder /home/myshare and see the same on guest /mnt

BuZZ-dEE
  • 14,223
Prinson
  • 11
  • 2