I have a centos6 web server where developers also upload by connecting through SFTP. So, to give developer login write permissions, I have change /var/www user to that user. My current permissions are: developer:root and with these, SFTP developer login can upload files, but apache can't upload files in them even with 777 permissions. I even tried with setting permissions like developer:apache, but of no avail.

How would I give both Apache and SFTP login write permissions at the same time?


i would recommend you to use acls here:

setfacl -R -m user:apache:rwx directory
setfacl -R -d -m user:apache:rwx directory
setfacl -R -m user:developer:rwx directory
setfacl -R -d -m user:developer:rwx directory
  • Thanks, but is there any way around else using ACLs? – Hashmi Feb 5 '15 at 9:04
  • you can use common group for apache and developer, and then use sgid on directory (chmod -R g+s) to assure, that newly created files are with the same group. – undefine Feb 5 '15 at 9:18
  • But I wonder that what made a user do negative marking on my question. :O Was it a bad question? I did a lot of search really before posting my question. – Hashmi Feb 6 '15 at 12:45
  • I don't know :-) Maybe it was too trivial? – undefine Feb 6 '15 at 20:10
  • there's another issue now. Apache is fine and scripts can upload and change text dynamically. but sFTP developer user can not overwrite existing files owned by root. In WinSCP, they give timestamp issue. Is there any way around for this? – Hashmi Mar 8 '15 at 22:53

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.