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 have a www-data that was automatically set up when I installed Apache. I have a ftpuser that I configured myself to use with ProFTPd. I use a MySQL database with users that use this user to log on.

The problem is that Apache with PHP is working as it should, but I cannot add files with FTP. I tried to do chmod 777 mysite.com, and it worked, but now Apache gave me a 500 internal error. I suppose chmod isn't the correct way to go. I deleted my folder and made a new one.

How can I give ftpuser permissions to read and write, while www-data should not loose its permissions. I don't have much experience with Linux command line.

Thanks!

share|improve this question
    
check /var/log/apache2/error.log for the specific error that is happening when apache reports a 500 –  stew Jun 7 '12 at 13:33

1 Answer 1

up vote 1 down vote accepted

you could try changing the owner and group like this:

chown ftpuser:www-data mysite.com

chmod 775 mysite.com

This will allow ftpuser and the group www-data (in which the user www-data resides) to read and write files in the directory mysite.com and to change to this directory. Those commands do not affect it's subdirectories, you'll need the recursive switches for chown and chmod for that.

Don't use chmod 777. It's something you'll often find in forums and there's always a better way than giving permissions to everyone.

share|improve this answer
    
just as one shouldn't give everyone rights with 777, one shouldn't give the www-data user write access, as the www-data user write access unless it is specifically needed for some particular directory. The www-data user exists in order to have very few (write) privileges –  stew Jun 7 '12 at 13:32

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.