You probably want chmod +st /var/www/john
Read man chmod for all the details.
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?
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