2

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.

closed as off-topic by sebasth, schily, GAD3R, Archemar, Isaac Oct 29 '18 at 3:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – sebasth, schily, GAD3R, Archemar, Isaac
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    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
  • 1
    Check for SElinux denial : ( $ sudo grep denied /var/log/audit/audit.log ) and look if there is something related. – tonioc Mar 8 '18 at 9:24
0

If you have a systemd service on CentOS 7, 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
[Service]
UMask=0002
# 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
  • 2
    You should not change systemd file located in /usr/lib/systemd, but instead, first disable service then copy the file to /etc/systemd/system and finally re-enable it with the right file. Next, make your change and reload with systemctl daemon-reload – Bruno Mairlot Jan 9 '17 at 11:02
  • 1
    centos 6.x doesn't have systemd... – tonioc Mar 8 '18 at 9:23

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