Whenever I work on my local machine I am almost always experiencing problems related to file permissions settings, and since I guess they may be related with my local machine configuration I would like to explain how did I configure it in order to get advice on how to configure it properly (Since my knowledge on server configuration is quite limted and I am far from being a sysadmin).
My local machine is using ubuntu as OS and I installed php5, php5-mysql, mysql-server, apache2 and phpmyadmin separately using ubuntu's packages. The only custom configuration I made is that I don't place the websites in
etc/apache2/www folder as default but on a specific folder at my home partition
~/www . In order to make this settings work I have to do follow this steps:
- I edit
/etc/apache2/sites-enabled/000-defaultas to point to that folder by replacing
/var/wwwwith the path to
- Restart apache (
sudo /etc/init.d/apache2 restart)
- Create a symlink inside
~/wwwwhich points to
# ln -s /usr/share/phpmyadmin /home/carlos/www/phpmyadmin)
This configuration has the following benefits which are quite important to me:
- I can keep my code safe whenever I install a new ubuntu release (this is, every six months) yet at the same time I can format / partition without losing any data.
- I don't need extra permissions (sudo) every time I want to edit any file (which is often, since it's my development environment), update modules and so on.
However, it also has some drawbacks like the ones I mentioned with file permissions, and I think they are related to the fact that the owner of the files and folders is not www-data user but my own user.
Is there any way to prevent problems with file permissions but also preventing having to place the files in