2

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 

->

root:x:0:
...some rows...
www-data:x:33:ftpdude,root
...more rows...
ftpdude:x:1000:

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

I even tried

www-data:x:33:ftpdude,root,www-data

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?

1

1 Answer 1

3

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?

3
  • Here's one: -rw-r--r-- 1 www-data www-data 113969 2011-10-16 10:06 IMG_3706.JPG
    – Apeli
    Oct 16, 2011 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. Oct 16, 2011 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, 2011 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .