[Nut-upsdev] usbmon fails silently to start with invalid RUN_AS_USER values
Arjen de Korte
nut+users at de-korte.org
Mon Jun 25 11:47:35 UTC 2007
Håkon Løvdal wrote:
> Say that a careless user starts editing upsmon.conf before having read
> the complete documentation (not that I know of any such users of course)
> and starts by adding "RUN_AS_USER = nutmon" and then creates this user.
> Later he discovers that the rpm package already has created a "nut" user
> and therefore deletes the nutmon user but forgets to update upsmon.conf.
> In this case usbmon will fail silently to start up, without any clues why.
The clues are in the syslog. If you're able to create new users, we
expect you to be able to read the syslog (and documentation) too.
> Please add some code to usbmon to output a descriptive error
> message in this case.
This is a classical chicken-and-egg problem. We can only drop privileges
when we have forked a child process that stays around to shutdown the
machine in case that's needed. However, we can not do this before
backgrounding and therefor loose the console to output errors to. So at
the time of backgrounding, we still need privileges and at the time of
changing to RUN_AS_USER we don't have the console anymore.
Theoretically we could check for the existence of RUN_AS_USER, but this
still doesn't guarantee successful startup. Therefor, I don't think this
is really worth all the effort.
Best regards, Arjen
More information about the Nut-upsdev