This question already has an answer here:

I need to give permission to a directory in such a way that, the newly created files should inherit the same permissions as the directory.

  • You may find a duplicate for this question, but it doesn't seems to be answered properly. So please update.
share|improve this question

marked as duplicate by muru, Tim, Eric Carvalho, Kevin Bowen, Luís de Sousa Jul 2 '15 at 12:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 10 down vote accepted

You could assign a group ownership to a parent folder and then make inside files inherit properties.

Assigning group ownership could be set by

sudo chmod -R 660 /path/to/parent
sudo chown -R myself:somegroup /path/to/parent

The group ownership can be inherited by new files and folders created in your folder /path/to/parent by setting the setgid bit using chmod g+s like this:

chmod g+s /path/to/parent

Now, all new files and folder created under /path/to/parent will have the same group assigned as is set on /path/to/parent.

Source

share|improve this answer
1  
The person who posted that didn't clearly understand what they were doing. myself:somegroup is something you use with chown, and 660 with chmod. You can't mix one with the other. – muru Jun 29 '15 at 10:38
1  
@muru : Correct...! The following command did work... <sudo chmod -R 777 /path/to/directory> but newly created files are not inheritting the permissions. Whenever running the commands, they are getting altered.... – kiran bbnl Jun 29 '15 at 13:59

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