Ubuntu – How to share a directory from host to guest machine in VirtualBox

18.04mountvirtualbox

I have a VirtualBox installed on Ubuntu 18.04 and within VirtualBox Ubuntu 18.04 is also installed i.e. both host and guest machine are the same OS. Now I need to transfer some files from host machine to guest machine, I followed instructions mentioned here.

But while issuing the following command in guest machine

$ sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) share ~/host

I am getting an error

mount: /home/atinesh/host: mount point does not exist

How can I transfer files from host machine to guest machine

Update:
I have created home directory in Guest OS, Now while Issuing the same command as mentioned above getting this error

mount: /home/atinesh/host: wrong fs type, bad option, bad super block on share, missing codepage or helper program, or other error.

Best Answer

Easiest to use VirtualBox Shared Folders.

Make sure that Guest Additions is installed in your VM.

In the Shared Folder setting for your VM... ie: using my Desktop folder...

enter image description here

In your VM...

In terminal...

sudo adduser $USER vboxsf # add user to vboxsf group

Log out, log in so that vboxsf is available.

Open a Files window and open the shared Desktop (in my example) folder. You may also see a sf_Desktop folder icon on the desktop.

Related Question