The easiest and the safest way to share some files between guest os and your default os is using shared folders. Just follow these steps and start using your shared folders.
-Firstly, you need to install guest additions to guest os. To accomplish that in ubuntu(for other distributions you need to find equivalent package)
sudo apt-get install virtualbox-guest-dkms
– After that, maybe you need to restart virtualbox. Start device again and select Shared Folder Settings… in Devices menu.
-Click + button from left, select a folder to share and edit other settings as you like, but be sure to check Auto-mount, sometimes it can be hard to mount manually.
-After restarting guest os, the folder probably be mounted under /media directory. (It can be mounted under /mnt or /mnt/hgfs folders, look for these folders if you cant find under /media). And it’s just that. If you are getting an error like “You don’t have permissions to see this folder” while accessing to folder, you just need to add your user to vboxsf group by giving this command(in guest os):
sudo usermod -a -G vboxsf your_user_name
You need to log out and log back in(in guest os of course). From then, you can easily share your files between guest and host os.
-Additionally, you can learn your user name in terminal by this command: