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?

有帮助吗?

解决方案

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

Read man chmod for all the details.

其他提示

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top