Sign up ×
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/ 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.… $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

1 Answer 1

if you have a systemd service on CentOs7 you need to stop the service and enable it again to have it fixed

systemctl stop httpd

vi /usr/lib/systemd/system/httpd.service 
# add this
# safe the file with esc ZZ

# enable and start apache again
systemctl enable httpd
systemctl start httpd

Then the funny part is that i have chmod 774 and not 770 mmm

-rw-rw-r-- 1 apache apache  405163 Apr 26 11:04 0FreeRADIUS.pdf
-rw-rw-r-- 1 apache apache   42496 Apr 26 11:05 admiraliteitsraad.doc

share|improve this answer

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.