Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant vm + apache permission denied for mkdir()

I am using vagrant to run my vm using ubuntu, apache, etc. This is running on my OSX host.

Everything works fine until my php application tries to create a folder, files within that folder, etc. I get Permission denied. What am I missing on the provision / configuration of the vagrant file?

like image 579
ronaldosantana Avatar asked May 16 '13 11:05

ronaldosantana


2 Answers

in this case, if you're using Vagrant + Apache2.

the solution is:

  1. edit /etc/apache2/apache2.conf;
  2. Search for User and Group directives
  3. Change these lines to:

    User vagrant
    Group vagrant
    
  4. run sudo service apache2 restart

its not possible to change /vagrant directory owner to www-data (apache user);

Anyway, it works for me.

like image 120
Nando Sousa Avatar answered Sep 24 '22 05:09

Nando Sousa


Edit Vagrantfile

  config.vm.synced_folder "./", "/var/www", owner: "www-data", group: "www-data"
like image 34
dlarchikov Avatar answered Sep 23 '22 05:09

dlarchikov