2

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"]
  • Can you please show us what the error is like? :) – fab Jul 20 '17 at 17:45
  • did you try the full path of the directory ? `config.vm.synced_folder "/Users/", ...` – Frederic Henri Jul 20 '17 at 20:44
  • No Error. The directory is empty. @FrédéricHenri I tired complete path and it is working. My objective is to sync the home directory of the user who uses my vagrant box. So irrespective of username I need to sync the user's home with my vagrant. – Rohan Kankapurkar Jul 21 '17 at 18:20

1 Answers1

6

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)

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139