This explains how to share files and folders (directories) between host and guest. (Files are shared over a network, in other words, you access remote files. For virtual machines, the network between host and guest is virtual since they are on the same real machine. But the steps you take are similar to setting up file sharing over real networks.)
Installing Guest Additions:
- Before sharing folders, you must install Guest Additions. For installing, You can do this by going to” Devices” and clicking on “Install Guest Additions” as shown in below picture,
- In next step it will ask you to enter the password for the user. Enter the” Password ” and go with Next.
- In the next step go with “Run” .
- The installation will go on like as shown in below. After the completion just close the window,
Adding Share Folder:
- After installing Guest additions again go to “Devices” and click on ” Shared folder settings” as show below,
- By selecting on “Shared folders” the below picture will be shown, click on the folder symbol at right side of window to add the share folder.
- Create a sharing folder which you wants to share. There are three modes available for share folder “Read only” ,”Auto-mount” and “Make permanent“. You can choose any of them and click on “OK” after choosing,
- The new Shared folder will show up under Machine Folders if you chose to make it Permanent, otherwise it will show under Transient Folders. Click on “OK” to close the window.
Mounting Share Folder:
- After this once reboot the system and open the terminal and check the mounted shared folder as show below figure, Here the shared folder with the name has mounted. Check by df -h command,
- You can manually mount the shared folder with a shared folder named share, as above, the folder can be mounted as the directory ~/host with the command
# mount -t vboxsf -o uid=$UID,gid=$(id -g) < share name> <mountpoint name>
# mount -t vboxsf share /u01
This completes the procedure for share folder.