It may be just my setup but if I create a virtual machine using Vagrant I usually end up with a WordPress installation that has trouble uploading files due to permission issues. This can be solved by setting the owner and the group in the
Vagrantfile but this isn’t ideal.
If I set the owner and group to
www-data WordPress works fine, but I need to sudo my commands in the terminal, even for a simple file creation operation. I finally had some time to figure this out and it turns out it isn’t that difficult.
You’ll need to edit the
/etc/apache2/apache2.conf file in your virtual machine. Find the User and Group directives and make sure vagrant is used for both:
User vagrant Group vagrant
Once this is added, make sure to restart your server using
sudo service apache2 restart and everything should be dandy. The terminal won’t scream for sudo all the time and WordPress will upload images/plugins/themes and such without a hitch.