-1

I have a website which is owned by user apache and group apache and I want to allow another user to be able to work within a folder on the website - I need them to be able to edit and create new files within that folder.

I added a user and assigned them a password and then changed their home directory to the folder I want to give them access to.

/etc/passwd
peter:x:1016:1017::/home/application/public_html/documents:/bin/bash

Then I added them to the apache group:

[root@app01 documents]# groups peter
peter : peter apache

And then ensured that the folder in which I want them to work is (a) owned by apache and (b) allows the group to read and write. (I also tried 777 as a test but still didn't work)

drwxrwxr-x+  6 apache apache     4096 Nov 16 09:03 documents

Then I log in as the user and try to create a file within the folder but I get the below:

-bash-4.2$ touch 123.txt
touch: cannot touch ‘123.txt’: Permission denied

[root@app01]# getfacl documents
# file: documents
# owner: apache
# group: apache
user::rwx
group::r-x
group:apache:rw-
mask::rwx
other::rwx
default:user::rwx
default:group::r-x
default:group:apache:rw-
default:mask::rwx
default:other::r-x

I can edit files in the directory and save them with no issues but not create new files or folders - what else do I need to do to allow this to work?

  • 1
    '+' at the end of the permissions means the directory has an Access Control List (ACL); see serverfault.com/questions/227852/… . Look at getfacl if Linux, or ls -e if MacOSX. – dave_thompson_085 Nov 16 '16 at 12:35
  • Ah interesting, I will get the output and see what it shows – bhttoan Nov 16 '16 at 12:41
1

typically you'll want to create shared / co-op space outside user homes, /var/www/website1/public_html as a suggestion.

create a group called website1 and a user website1, also create a group website1-admin.

you can then set the dirs to be 775.

/var/www/website1 can be website1:website1-admin /var/www/website1/public_html can be website1:website1

then add all users who need write access to website1 group, also add apache to this group.

the admins can be put in group website1-admin, which will allow then access to edit files outside the public_html.

this allows you to keep the user's home /home/wesbite1 locked down to 700.

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.