خرید بک لینک

We have a couple Apache VirtualHosts on a CentOS 7 server, and the PHP sometimes requires the ability to create/edit/delete files and/or folders, so it's important that the permissions always be apache.apache recursively.

The deployments are done via Jenkins, as the Jenkins user, and I know I can just add a simple shell execution to chown -R apache.apache /var/www/website, and I will, but if someone other than myself does a manual deployment, or anything that would change the permissions, such as creating a new file or folder, then it could potentially cause some issues.

I thought about just making a cron job to chown the entire directory every so often, but there's going to be 4 different VHosts, and possibly a large amount of files for each, so doing that frequently isn't optimal, but then again, not doing it frequently means there could be issues between when the perms were changed and the cron job runs.

So does anyone know of a good way to make sure the owner is always set for a specific directory? (recursively) regardless of what user does what?

I first thought of Sticky Bits.. but I that would only work for the permissions, not ownership.

I then thought about using something like entr, which I found under a simple google search. It's not available in any repo I could find, so you have to install it manually, but it basically fires off commands you specify when it sees any changes in folders/files, so something like

ls -d /var/www/foo.company.com | entr sh -c 'chown -R apache.apache /var/www/foo.company.com && echo "Chowned at $(date)" >> /var/log/entr.log'

would suffice... But I'm sure there's a solution that doesn't require manually installing this binary on the servers (I try to manage the packages via yum as much as possible)

Any help would be appreciated!

Thank you

برچسب: نویسنده: استخدام کار تاريخ: شنبه 11 ارديبهشت 1395 ساعت: 0:18

صفحه بندی