Ubuntu – Set default owner/user

permissions

I'm a web developer, and so have set-up an old machine in the office as an Ubuntu Server, for the purposes of testing websites.

I've set-up LAMP and have created a /var/www folder, from which all my local sites are served. The issue is that of user permissions, i.e. any files that I copy into that folder (from my Windows machine via the network) automatically take on me (daniel) as their owner. The problem is that I want www-data to become the owner.

I did some research and saw that it should be possible to use setuid (and setgid) to automatically set www-data as the owner of all files put into /var/www automatically, so far I've not had any luck making it work.

Can someone help please? Thank you

UPDATE: Would this do what I want it to do? Default file permissions for php user www-data

UPDATE 2: I've kinda fixed my issue by changing my samba settings. Using Webmin, I was able to go in and change the default settings (as seen here: http://imageshack.us/photo/my-images/521/captureon.png/)

Best Answer

This was fixed by the user by setting the following file permissions using Webmin:

  • New Unix file mode: 664
  • New Unix directory mode: 775
  • Force Unix user: www-data
  • Force Unix group: www-data
  • Allow symlinks outside share?: Yes [questionable]
  • Can delete readonly files?: No
  • Force Unix file mode: 000
  • Force Unix directory mode: 000

See:

enter image description here