Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows issue with symlinks in VBox shared folders

I have an Ubuntu 17 VM on Virtual Box, and my host OS is windows 8.1. I created a shared folder between host and guest OS.

Now, because windows doesn't support symlinks, this prevents me from putting any symlinks in the shared folder. Unfortunately, I need to put a react project in the shared folder and the project contains symlinks in the node-modules sub-folder. How can I solve the problem ? can I put symlinks and tell windows somehow to ignore them or prevent ubuntu from sharing them?

like image 487
Ahmed Hussein Avatar asked Apr 26 '18 06:04

Ahmed Hussein


People also ask

Can you share Symlinks?

symbolic link is basically a file that points to another file, which can be a file on a remote share. As a file it cannot point to a remote folder and cannot contain slash in its name.


1 Answers

In fact, Windows file system supports symlinks but with 2 restrictions:

  1. Is disabled by default.
  2. Is available only if you have administrative privileges

I use it with Vagrant on Windows 7 and Windows 10.

First you must enable symlinks feature in your VM like this:

VBoxManage setextradata MACHINE_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1

Where MACHINE_NAME is the virtual box guest machine name and SHARE_NAME is the share name inside the box config. If you use Vagrant you can add this to Vagrantfile:

config.vm.provider :virtualbox do |vm|
    vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME", "1"]
end

Next, you need to enable symlinks in Windows host machine:

  1. Open Start > Windows Administrative Tools > Local Security Policy
  2. Go to Local Policies/User Rights Assignment in tree view.
  3. Add user name or user groups you belongs to, to entry Create symbolic links.
  4. Restart.
like image 102
Łukasz Jakubek Avatar answered Sep 27 '22 21:09

Łukasz Jakubek