Create symlinks inside a VirtualBox shared folder

While working inside debian, which is installed inside a VirtualBox and shares a folder with it’s host machine, I repeatingly got errors while creating symlinks. (I use “os x 10.7” as host and “debian wheezy” as guest os.)

Until now I accepted it but today I got tired of creating these symlink in the host system.

Here’s the solution I found:

1. Shut down the virtual machine. Debian in my case.
2. You need to close the VirtualBox GUI.
3. Type this into your preferred command line.

VBoxManage setextradata DEBIAN VBoxInternal2/SharedFoldersEnableSymlinksCreate/FOLDER_SHARE 1

4. Reboot your virtual machine.
5. Enjoy the stunning power of symlinks again*

* You ask why again ? Because this was possible by default prior to VirtualBox 4.1.8. It has been added for additional security.

Port Forwarding to a VirtualBox Debian

Set up port forwarding:

VBoxManage modifyvm "VM name" --natpf1 "to_ssh,tcp,,22,,22"
VBoxManage modifyvm "VM name" --natpf1 "to_http,tcp,,80,,80"
VBoxManage modifyvm "VM name" --natpf1 "to_https,tcp,,443,,443"

Replace “VM name” and <GUEST IP> with your desired configuration. If your guest OS use DHCP then can be omitted. natpf1 stands is the network interface to use. In my case NAT is Network Adapter 1.

To remove them again:

VBoxManage modifyvm "VM name" --natpf1 delete "to_ssh"

‘VBoxManage’ should be installed on your host os by the VirtualBox installer.