Vagrant shared folder and symbolic links under Windows 10

11,022

I was struggeling a long time with the same issue. Make sure that:

  • The VirtualBox Option "SharedFoldersEnableSymlinksCreate" is active for each Folder *1)
  • You MUST run the GitBash as "Admin" user because it seems that Usermanagement in Windows just allows the symlink creation for "Admin" users *2)

    1. You can do it manually from Windows command line (setextradata via VBoxManager) or via the Vagrantfile like

      virtualbox.customize ['setextradata', :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant", '1']  
      
    2. Right click on GitBash icon and run as Administrator

      German version of "Run as Administrator"

    Afterwards you should be able to log into the vagrant box and create symlinks inside shared folders which showup in Windows explorer as .symlink files.

Share:
11,022

Related videos on Youtube

Kevin Horst
Author by

Kevin Horst

Updated on September 18, 2022

Comments

  • Kevin Horst
    Kevin Horst over 1 year

    I have a vagrant box with Linux inside under Windows 10 (VirtualBox 5.1.4, Vagrant 1.8.5). I'm working with the Git Bash as normal user. Inside the vagrant box I cannot create a symlink:

    c:/path/to/my/vagrant-project/ vagrant up + vagrant ssh
    /home/vagrant/my-shared-folder/ $ ln -s /any/path/to/linux/box/folder my-symlink-name
    /home/vagrant/my-shared-folder/ $ ln: creating symbolic link `my-symlink-name': Protocol error
    

    Under Windows 7 it was working with: How do I create a link in Windows 7 home premium as a regular user?

    So, has anything changed under Windows 10?

    • das-g
      das-g over 7 years
      What happens when you issue that ln -s command? Do you get any error messages?
    • Kevin Horst
      Kevin Horst over 7 years
      I just added the error message to my question. I found out, that I have to start the Git Bash as administrator to get this running. Is there a way to extend the normal user with "create symlink permissions"?
    • Don't Root here plz...
      Don't Root here plz... over 7 years
      Nothing has changed in the symbolic links part of Windows 10.
    • Ryan
      Ryan about 4 years
      For me, running as administrator was not enough, and I still got "Protocol error" when trying to create symlinks. Here was what worked: stackoverflow.com/a/60741351/470749
  • Kevin Horst
    Kevin Horst over 7 years
    this doesn't work for symlinks as described above
  • Ramhound
    Ramhound over 7 years
    "This is not a solution to the original question" - If it is not an answer to the question that was asked, then why are you submitting it as an answer, to the question that was asked? Please take into considering that commentary should never be submitted as an answer.
  • Ramhound
    Ramhound over 7 years
    I wouldn't have known it was an answer to this question, since you literally indicated, it wasn't an answer to the question.
  • velop
    velop over 6 years
    To my knowledge /vagrant in "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant" specifies the shared folder in which symlinks are allowed. v-root specifies the root of the vm. Furthermore symlinks are activated by default for v-root.
  • UpTheCreek
    UpTheCreek almost 5 years
    I use both these steps, and still have symlink failures when doing npm install for certain packages.