Thursday, June 16, 2016

apache 2.2 - Made a mess of privileges for /var/www

I've got an installation of Ubuntu 10.10 running in virtualBox which I'm going to use for some local development. I've installed PHP, Apache and MySQL and want to use vsftpd to access /var/www so I can develop on my Windows installation (from which virtualbox is running) and FTP over the files.



I was originally getting an error saying that access was denied when I was transferring files over FTP to /var/www so I figured some chmod tweaking was needed. I'm no expert so did some reading beforehand and executed the following:



sudo chmod -R 777 /var/www
sudo chown james:james /var/www


I can now FTP files over, but when loading up newly transferred files in the web browser, I receive a permission denied error. The new files don't have the 777 permission which I set - surely you don't need to use chmod every time you transfer something new over?




This is simple stuff I'm getting stuck with so I just know there's going to be permission problems with PHP and MySQL accessing things in the future so I could really use some help! If anyone would be so kind as to suggest some privileges I can use, I would be most grateful. Security isn't a concern as this is all local and I just want to get it up and running ASAP!



Probably would have been better off installing XAMPP on my Windows installation but I wanted to keep it separate and learn a thing or two along the way to getting this set up!



Here's the output from ls -l /var/www



-rw------- 1 james www-data 3458 2011-03-31 00:36 g.jpg
-rwxrwxrwx 1 james www-data 177 2011-03-27 23:16 index.html
-rwxrwxrwx 1 james www-data 21 2011-03-28 01:18 test.php



index.html and test.php were in /var/www before I executed the chmod command and g.jpg was FTP'ed over after I messed around with the privileges. I've run chown james:www-data, but that hasn't helped with the Apache access problem.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...