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?


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?

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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