Answer the question
In order to leave comments, you need to log in
How to set permissions for writing to a directory on a virtual machine under Vagrant?
Hello. There is a site, Yii2 framework, raised on vagrant + puphpet.
The problem is that assets and runtime are not being written to.
The Vagrantfile itself says:
Vagrant.configure('2') do |config|
eval File.read("#{dir}/puphpet/vagrant/Vagrantfile-#{data['target']}")
config.vm.synced_folder "./workspace", "/var/www", id: "vagrant-root",
:owner => "vagrant",
:group=>"www-data",
:mount_options=>["dmode=777,fmode=777"]
end
Answer the question
In order to leave comments, you need to log in
I use script for provision ansible. But bash can also be used. The crux of the matter is that the vagrant user has the ability to execute sudo commands without a password. Vagrant makes it possible to run bash code or an Ansible playbook. Conclusion: we create a bash file in which we write the chown and chmod commands to the required directories. Profit!!!
config.vm.provision, type: "shell", run: "always" do |s|
s.path = "pdrovision.sh"
s.privileged = false
s.keep_color = true
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question