Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running a Linux webserver (apache2) and I'm having problems with modifying files between different users. The biggest problem is deleting files created by apache/php via FTP, I just get Permission denied. I've been trying to add the ftp-user and apache to the same group but it won't work.

Here's my setup now:

nano /etc/group 


...some rows...
...more rows...

All the files that are created by php have Owner 33, and ftp'd files have Owner 1000.

I even tried


but it had no effect.

Only way I've managed to make the php-created files deletable is to chmod(file, 0777) all those files but I really don't/shouldn't want to do that. What am I not getting right here?

share|improve this question
possible duplicate of FTP and Apache permission issues – quanta Oct 16 '11 at 10:27
up vote 3 down vote accepted

Adding ftp-user to www-data group it's ok, but you probably need to change the default umask for apache:

# echo umask 002 >> /etc/apache2/envvars

Can you provide the output of ls -la of a php-created file?

share|improve this answer
Here's one: -rw-r--r-- 1 www-data www-data 113969 2011-10-16 10:06 IMG_3706.JPG – Apeli Oct 16 '11 at 11:32
Yep, now it's clear that adding the ftp-user to www-data group isn't enough. You should change the default umask from 022 to 002, system-wide in /etc/profile or in some apache-related script, like the startup script or /etc/apache2/envvars. – Giovanni Toraldo Oct 16 '11 at 12:20
Yeah, that did the trick! There wasn't a umask entry in envvars but I created it, restarted apache (don't know if it was necessary) and now it works. Excellent, thanks! – Apeli Oct 16 '11 at 15:06

Your Answer


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.