How to Enable File Sharing between Host and Virtualbox Guest
In a previous tutorial, I showed you how to install virtualbox guest additions on Debian. This tutorial will explain how to enable file sharing between host and virtualbox guest OS. In order to do this, you have to install guest additions in the guest OS first, so if you haven’t done yet, check out that post and go back here when you are done.
Enable File Sharing between Host and Virtualbox Guest
In the Virtualbox Manager window, right-click on your guest machine and select Settings.
In the left pane, select Shared Folders. Then click on the add button to add a shared folder.
Then in the Folder Path field, select a folder on your host machine.
You can check Read-only to let your guest have read access but no write permission to the shared folder on the host machine. Check Auto-mount to auto-mount the shared folder when the guest OS boots up. After that, click OK button.
Now start the Linux guest machine. In /media/ directory of the Linux guest, you will find a new directory called sf_shared_folder if the shared folder name on the host is
shared_folder. By default, only root and members of the vboxsf group have read and write access to this directory. So what we need to now is add your user to vboxsf group. Open up a terminal in the guest machine and enter the following commmand. Replace <username> with your real username.
sudo gpasswd -a <username> vboxsf
Log out of the current session and log back in. Now you can access the /media/sf_shared_folder directory.
You can create a soft link that points to /media/sf_shared_folder.
ln -s /media/sf_shared_folder /home/<username>/shared_folder
The above command will create a shared_folder directory under user’s home. File created in shared_folder actually resides in /media/sf_shared_folder.
How to enable copy and paste clipboard between host and guest
Another thing you may want to do is enable copy and paste clipboard between host and guest. To accomplish that, open the settings window of your virtual machine. Go to General > Advanced. Change the value of Shared Clipboard and Drap’n’Drop to Bidirectional. Then click the OK button.