How to Access Folders on Ubuntu Host Machine from an Ubuntu Virtual Machine in VirtualBox
- Open VirtualBox
- Right-click your VM, then click Settings
- Go to Shared Folders section
- Add a new shared folder
- On Add Share prompt, select the Folder Path in your host that you want to be accessible inside your VM.
- In the Folder Name field, type shared
- Uncheck Read-only and Auto-mount, and check Make Permanent
- Start your VM
9. Install dependencies for VirtualBox guest additions:sudo apt-get update
sudo apt-get install build-essential linux-headers-`uname -r`
sudo apt-get install virtualbox-guest-utils virtualbox-guest-dkms
You’ll see a folder under /media directory named similarly to the folder you selected to share on your host machine with “sf_” added to the beginning of the name.
10. When VirtualBox installed the Ubuntu operating system, it added a group called “vboxsf”. Before you can access any shared folders, you must add yourself to the vboxsf group. To do this, press Ctrl + Alt + T to open a Terminal window. Type the following at the prompt, replacing “[username]” with your username, and press Enter.sudo adduser [username] vboxsf
11. Run following command in Guest machine:sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) <Host_machine_shared_dir_name> /media/sf_images/
12. This directory mount we just made is temporary and it will disappear on next reboot. To make this permanent, we’ll set it so that it will mount our directory on system startup
Edit fstab file in /etc directoryvi /etc/fstab
enter followimg line at the end<Host_machine_shared_dir_name> /media/sf_images/ vboxsf defaults 0 0
13. Restart Guest machine.
14. Enjoy!!!