The upsmon.conf has the option of setting RUN_AS_USER username Might it be possible to add a similar option to the upsd.conf file? I see the -u command-line option for both upsmon and upsd, however, upsd doesn't seem to carry that to the configuration file, as upsmon does. Thanks.
On Jun 18, 2014, at 1:51 PM, Mike. <the.lists at mgm51.com> wrote:> The upsmon.conf has the option of setting RUN_AS_USER username > > Might it be possible to add a similar option to the upsd.conf file? > > I see the -u command-line option for both upsmon and upsd, however, > upsd doesn't seem to carry that to the configuration file, as upsmon > does.I'll admit this does seem arbitrary, but based on a quick look at the upsd source code, the userid is looked up before the configuration file is read, and there is a chroot() in between those statements. So this will require some more investigation to see what assumptions are being made about the userid when the configuration file is processed. I hadn't noticed this until now, since most distributions tend to have a way to pass in options to their daemons (such as /etc/nut/nut.conf on Debian/Ubuntu). What we may want to do is add some comments to nut.conf for passing "-u user" in UPSD_OPTIONS. (It's in the man page for nut.conf, though.) -- Charles Lepple clepple at gmail
On 6/19/2014 at 9:03 AM Charles Lepple wrote: |On Jun 18, 2014, at 1:51 PM, Mike. <the.lists at mgm51.com> wrote: | |> The upsmon.conf has the option of setting RUN_AS_USER username |> |> Might it be possible to add a similar option to the upsd.conf file? |> |> I see the -u command-line option for both upsmon and upsd, however, |> upsd doesn't seem to carry that to the configuration file, as upsmon |> does. | |I'll admit this does seem arbitrary, but based on a quick look at the upsd |source code, the userid is looked up before the configuration file is |read, and there is a chroot() in between those statements. So this will |require some more investigation to see what assumptions are being made |about the userid when the configuration file is processed. | |I hadn't noticed this until now, since most distributions tend to have a |way to pass in options to their daemons (such as /etc/nut/nut.conf on |Debian/Ubuntu). What we may want to do is add some comments to nut.conf |for passing "-u user" in UPSD_OPTIONS. (It's in the man page for nut.conf, |though.) ============ Thanks for the quick reply. I'll give the nut.conf approach a try. It does look as if it will be the solution I need.