سؤال

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