I've installed a AWS Linux EC2 instance. I have multiple users who should be able to edit each others files, including new ones that are uploaded.

The Linux default is RHEL.

I understand that I can run the following in sudo, and this would create a new group, I would add the users to the group, it would change the permissions of the www directory to be owned by the group, and anyone in said group could manage those files without issue:

groupadd www
usermod -a -G www <user>
chown -R root:www /var/www
chmod 2775 /var/www
find /var/www -type d -exec sudo chmod 2775 {} + 
find /var/www -type f -exec sudo chmod 0664 {} +

However, any new files uploaded will still have the 755 and 664 permissions, thus not allowing the users to edit each others files again.

I believe this is an unmask, but my attempts at changing it have not been fruitful, so your help is greatly appreciated.

As a side note, what would be the correct way to change permissions of a ALL directories of a specific name only within /var/www/html? For example, every changing every instance of .htaccess in public html to 666, or changing every directory named private to 400? (Just as examples).

I believe this would work:

find . -name ".htaccess" -exec chmod +x {} +
find . -name "private" -exec chmod +x {} +

But I'm not sure, and would really appreciate the guidance.

Hopefully these questions are allowed and on topic. I'm a junior and am weary of doing things I don't fully understand on production servers.

  • How are you uploading ? – user9517 Jan 6 '16 at 19:21
  • SFTP. I know if I use git these permissions issues don't persist, but unfortunately Git isn't entirely set up, so I need to fix this issue for SFTP first. – Tania Rascia Jan 6 '16 at 20:00
  • serverfault.com/questions/150726/… but if that doesn't work then your clients aren't requesting the correct permissions. This is also relevant serverfault.com/questions/357108/… – user9517 Jan 6 '16 at 20:05
  • Hi. Thanks for the resources! I tried that one and it didn't work for me, but I guess I'll try again. – Tania Rascia Jan 6 '16 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.