[Nut-upsuser] access to upsrw
clepple at gmail.com
Tue Dec 29 22:25:46 UTC 2015
On Dec 29, 2015, at 3:27 PM, Gene Heskett <gheskett at wdtv.com> wrote:
> Greetings Charles;
> I hope you had a nice Christmas, and will have a happy and prosperous new
> year in 2016.
Thanks, and same to you!
> You mentioned upsrw in a message earlier, so I ran it, and found the
> shutdown timeout was only 20 seconds.
> So I tried to reset that to 120 seconds, which the battery can do nicely,
> and I have a 20kw in the back yard that is up and running, lights back
> on in 16 or 17 seconds, so is 98% moot, but found I cannot, even as
> root, adjust this.
> gene at coyote:~$ upsrw -s ups.delay.shutdown=120 myups
> Username (gene): gene
> Password: my user pw here
> Unexpected response from upsd: ERR ACCESS-DENIED
See "man upsrw" or http://www.networkupstools.org/docs/man/upsrw.html#_diagnostics
> Nut was never given a pw on this system. I, and ups however are members
> of group nut, and that has always seemed sufficient until now.
Why it defaults to the username of the logged-in user is beyond me, and lost in the history of NUT. It's tempting to change that Username message to at least point out that the username is being looked up in upsd.users. Since NUT typically drops root privileges early, it makes it complicated to use the system password file (especially on systems like Ubuntu where /etc/shadow is only readable by root).
However, back to your original goal of changing the shutdown delay: the "upsrw" command seems to have been designed for UPSes like the original APCs that stored settings in an EEPROM. I don't think many of the newer USB-based UPSes have a similar EEPROM (or maybe we override that), but the upsrw settings for the usbhid-ups driver (assuming you are still using the Belkin UPS you mentioned previously) are not permanent.
I think you want to set "offdelay = 120" (and "ondelay = 150" or so) in /etc/nut/ups.conf to allow two minutes between NUT starts the shutdown, and when the UPS finally cuts power.
clepple at gmail
More information about the Nut-upsuser