Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Can you please do an ls -l on some of the files which you uploaded via FTP? This would let us see the ownership & permissions on these files. –  Stefan Lasiewski Mar 31 '11 at 2:22
    
Have added the info above Stefan! If there's anything else, let me know :) –  james246 Mar 31 '11 at 15:57

1 Answer 1

I guess umask is what you need. umask is the *nix (POSIX) command used to set the permissions of the newly created files.

Most FTP servers directly implement the umask directive. For instance, the widely used ProFTPd has this directive, that you can configure the way you want.

Hope this helps.

share|improve this answer
    
Will take a look into umask, thanks! :) –  james246 Mar 31 '11 at 0:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.