Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In short, I have an authenticated HTTP-POST that:

  • posts a jpg image (created as 666 apache:www) into /directory1 (777 ftpuser:www)
  • creates /directory2 (created as 666 apache:www) in a 777 ftpuser:www dir
  • moves image into /directory2 (fails)

All of /var/www/website.com is ftpuser:www with the exception of Apache-created files of course.

Currently, the image is uploaded as 666 apache:www, the folder is created, but the next step of copying the photo fails. Where am I going wrong? I've tried setpacl on the apache user and umask but I'm spinning my wheels now.

  1. Why is it that the apache user can't copy a file it created to a folder it created?
  2. apache and ftpuser are both part of the www group. is this bad practice; what's the recommended practice?

Other notes: I'm using vsftpd for FTP and using a umask of 002 in my vsftpd.conf.

share|improve this question
Do you have selinux running on this system? Use the command getenforce to check. Also can you share what is doing the move? Is it a CGI script running on the server or something else? –  slm Apr 7 '13 at 4:46
It's an third party plugin. Your comment prompted me to find the line that's causing the problem. github.com/philbertphotos/Zenphoto-Lightroom-Publisher/blob/… $filename = $args['filename']; .. .. if (!copy($filename, $filepath.'/'.$filename)) return new IXR_Error()); –  Jarrett Barnett Apr 7 '13 at 22:12
Why don't you write that up as an answer and mark it as the accepted one so this question get's closed out. –  slm Apr 7 '13 at 22:39
I haven't resolved the issue yet; I'll troubleshoot that line to see if that reveals the underlying issue. –  Jarrett Barnett Apr 7 '13 at 23:01
The copy() function is probably going with some alternative permissions, it might be keying off of the umask that is set for the apache user. –  slm Apr 7 '13 at 23:47

Your Answer


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

Browse other questions tagged or ask your own question.