1

I have made some vhosts which resides on my home folder, and i have given the group access to www-data user. This way the project (a web system) renders on the browser.

This is a symfony based project, so that when i run some console commands some files may be created, but unfortunately it will have my user account as the group account. How can i dynamically change the owner (group owner) of that particular directory, so that on creation of every file: its ownership is set as :

user:www-data
  • Possible duplicate - http://askubuntu.com/questions/46331/how-to-avoid-using-sudo-when-working-in-var-www/46371#46371 – Panther Apr 11 '15 at 14:55

1 Answers1

7

You can set the setgid sticky bit on the directory to ensure that all new files in the directory will have their group set to the group of the directory.

To do that, run chmod g+s DIRECTORY, where DIRECTORY is the name of your directory.

zhongfu
  • 1,449