Page 1 of 1

Shared memory ownership

Posted: Sat Sep 24, 2005 9:14 pm
by JimNoble
Sometimes when my machine first boots, the shared memory segments get created owned by root.

Needless to say, this isn't good when zm is running as apache!

Restarting zm doesn't always fix it. The most reliable mechanism seems to be stopping zm, waiting a moment, deleting any segments with the right id, then starting zm. Mostly it gets created as apache then, and everything works, but not always.

Whenever I've checked, all zm processes have been owned by apache.

However, I have noticed that /usr/lib/zm and all below it is owned by root. Should it be apache?

Jim

Posted: Sat Sep 24, 2005 9:41 pm
by JimNoble
D'Oh! :x

30 seconds later the penny drops.

I have a cron job that runs a script which grabs an image by running zmu -i

This doesn't work as a plain user, so I [temporarily] set up the ability to run this one command as root using sudo.

(Can you see where this is going? :-)

At boot time, it's a race between zm starting up properly, and the cron job being kicked off. If the cronjob gets there first, the shared memory gets created (even though zm isn't running yet).

Similarly, if the cronjob runs (as it does, once a minute) while you're restarting, the same thing happens.

:roll:

I've changed it so do "sudo -u apache" and all it well again. (Just have to figure out the magic runes for /etc/sudoers to only allow it with '-u apache' now...)

It would work better if there a way to allow an "ordinary" user to extract an image with zmu...?

Jim