Search code examples
vagrantvagrantfilevagrant-provision

Unable to sync home directory in Vagrant


This is the code I tried

config.vm.synced_folder ENV['HOME'], "/home/vagrant/myHome", :mount_options => ["dmode=777,fmode=777"]


 config.vm.synced_folder "~", "/home/vagrant/myHome", :mount_options => ["dmode=777,fmode=777"]

Solution

  • You should be able to get the user's home directory using ruby directly - Dir.home

    config.vm.synced_folder "#{Dir.home}", "/home/vagrant/myHome" ...
    

    should get the current user's directory (should work on Windows too)