Question

How I can make sure that all new files created in a folder (by any user) inherit the folder ownership, for example:

/var/www/john -> owned by john:john

As the user root I create a new file into this folder, and the default ownership will be root:root, but I need that this new file inherit automatically (without chown or other) the john:john ownership.

Is it possible?

Was it helpful?

Solution

You probably want chmod +st /var/www/john

Read man chmod for all the details.

OTHER TIPS

You can su to john first before creating the new file. Run the following and newfile will be owned by john:john.

su john
touch newfile
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top