Monday, 4 November 2019

permissions - I've set up Apache, but I can't write to the '/var/www' folder


I've set up Fedora 14 with Apache, MySQL and PHP for my own homepage on a "server" (read: old hardware scrapped together).


I'm logged in with my user, but I have no rights on /var/www/html.


How do I change this, so that I can save my files to this folder? Maybe change the permissions or redirect the folder to my home folder?



Answer



The www folder is created by most distributions during the apache setup process. As the setup process is run by root, the www folder is owned by root. Use ls -al in /var to look at it's permissions.


drwxr-xr-x  5 root root  4096 May  2 11:34 www

chmod and chown are GNU coreutils that you can use to modify the permissions of unix directories.


Use chown to change the owner and group of /var/www/html/ to your user and group, e.g.


sudo chown -R jason:jason /var/www/html/

As you're likely to start putting PHP scripts in here, you'll then need to use chmod to make sure the apache user (in most cases www-data) is allowed to execute them.


Try and understand how Unix permissions work before proceeding any further as it will save you some time down the line. Good luck.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...