I have vsftpd up and running on my Ubuntu server. This is a development server and I want to be able to FTP my code directly to the directory which Apache is serving out.
As most of you know, www-data is the Apache user and the www-data user needs to have permissions to the directory that Apache is serving out.
I didn't want to make www-data an FTP user as well, so what I did instead was create another user for use with FTP, and put both www-data and the new user in a new group called www.
I did a chown -R www-data:www *
to the directory that Apache is serving and it works mostly fine.
The issue comes in when I FTP upload a file that didn't previously exist in that directory. The owner gets set to my FTP user. I want the owner to get set to www-data and the group to get set to www whenever a new file gets uploaded.
Is there any way to do this with vsftpd?
I've been furiously googling around for hours, but I can't find a way to do it. Any help would be greatly appreciated.
Edit:
I just set up a couple of cron jobs to run every minute and set the permissions:
*/1 * * * * chown -R www-data:www /var/www
*/1 * * * * chmod -R g+rw /var/www
It works but it's kind of clunky, and there's a ~1 minute delay between me uploading new code and having it work when I hit F5 in my browser.