Host setup
First make sure you've installed Guest Additions on your virtual machine. If you didn't see this. Go to Virtual Box, your virtual machine and click Settings.
Create a folder within host (using Windows 7) or choose one. Remember the Folder name we will use it when setting up our shared folder in guest (Debian / Ubuntu).
1. Auto mount using VBox
Wait! Auto-mount?
I see "Auto-mount" option there! This option will make your shared folder mounted automatically on guest boot. This is what we want! BUT.
Checking auto-mount will mount your shared folder into /media/<your folder name>
in your guest.
TIP: Type df
command into console to see where is your shared folder mounted.
If you are fully satisfied with this way. You're done. You don't have to read this post further.
2. Auto mount to custom location
Mount your shared folder into custom location. Such as www folder of your Apache or nginx web server etc.
Always rember to disable Auto-mount option in VBox settings. Do not forget.
Launch your virtual machine. Remember to create folder in guest before mounting.
Adding mount command into rc.local could cause problems. Better to not do it. Use fstab instead.
Add module
Go to sudo nano /etc/modules
And add this to the end of the file
vboxsf
vboxvfs
vboxadd
Add command to fstab
Go to sudo nano /etc/fstab
And add this line to the end of the file <your folder name> <your custom path to the folder> vboxsf default 0 0
Now you can reboot your virtual machine to see changes.
If you have any suggestions, please leave a comment or edit my answer!