[Resolved] Issue changing the apache user/group
Posted: Thu Sep 28, 2017 2:18 pm
First of all, yes I know what I'm doing isn't recommended. I'm aware of the drawbacks, particularly regarding updates, when not using the default apache user/group for ZoneMinder. My setup is a Cent OS 7.3 machine running Asterisk/FreePBX and ZoneMinder 1.30.4, among other things, together on one machine.
I know that the best way to do this is with VMs, but I have some PSTN hardware constraints that would prevent Asterisk from working properly on a VM.
I also know that the next best way to do this is with separate hardware, but that's not an option due to our space and heat dissipation ability at this location, as well as not being economical. This server is replacing another server that has been chugging along for four years with ZM and Asterisk/FreePBX working in harmony.
With all of that out of the way, I have ZoneMinder and Asterisk playing nice. My Apache user/group is "asterisk" and that's what ZM is running on as well.
However, whenever I reboot, the user/group ownership of the sock and temp directories in /var/lib/zoneminder are inexplicably reset to apache:apache. The ZoneMinder service will not start until I chown -R those back to asterisk:asterisk, but after I do that it works fine. Before that, I get the following:
I'd like to fix this without dirty hacks. What is changing the owner on those directories and how do I stop or correct it? The ZoneMinder service isn't set to run automatically, and after I make the change and start it for the first time, it doesn't mess with the permissions. So I don't think that's the issue.
My /etc/zm/zm.conf files has ZM_WEB_USER and ZM_WEB_GROUP set to asterisk. Am I missing somewhere else that I need to make that change?
I know that the best way to do this is with VMs, but I have some PSTN hardware constraints that would prevent Asterisk from working properly on a VM.
I also know that the next best way to do this is with separate hardware, but that's not an option due to our space and heat dissipation ability at this location, as well as not being economical. This server is replacing another server that has been chugging along for four years with ZM and Asterisk/FreePBX working in harmony.
With all of that out of the way, I have ZoneMinder and Asterisk playing nice. My Apache user/group is "asterisk" and that's what ZM is running on as well.
However, whenever I reboot, the user/group ownership of the sock and temp directories in /var/lib/zoneminder are inexplicably reset to apache:apache. The ZoneMinder service will not start until I chown -R those back to asterisk:asterisk, but after I do that it works fine. Before that, I get the following:
Code: Select all
Sep 28 09:12:55 localhost.localdomain zmdc[1597]: FAT [Can't bind to /var/lib/zoneminder/sock/zmdc.sock: Permission denied]
Sep 28 09:13:03 localhost.localdomain zmdc[1593]: FAT [Can't connect: No such file or directory]
Sep 28 09:13:03 localhost.localdomain zmpkg[1581]: ERR [Unable to run "/usr/bin/zmdc.pl startup", output is "Starting server"]
Sep 28 09:13:03 localhost.localdomain systemd[1]: zoneminder.service: control process exited, code=exited status=255
Sep 28 09:13:03 localhost.localdomain systemd[1]: Failed to start ZoneMinder CCTV recording and security system.
Sep 28 09:13:03 localhost.localdomain systemd[1]: Unit zoneminder.service entered failed state.
Sep 28 09:13:03 localhost.localdomain systemd[1]: zoneminder.service failed.
My /etc/zm/zm.conf files has ZM_WEB_USER and ZM_WEB_GROUP set to asterisk. Am I missing somewhere else that I need to make that change?