[Nut-upsuser] Confusing Generic USB UPS cannot be matched

Charles Lepple clepple at gmail.com
Sun Nov 27 21:34:58 UTC 2011


On Nov 23, 2011, at 10:13 AM, R. G. Newbury wrote:

> On 11/22/2011 07:42 PM, Charles Lepple wrote:
> 
>>> [root at tor2 ups]# upscmd -u nut -p nutpass nexxtech beeper.toggle
>>> Unexpected response from upsd: ERR ACCESS-DENIED
>>> 
>>> And using nut at 127.0.0.1 or nut at localhost gives the same result (even though upsd reports to syslog that nut at 127.0.0.1 is logged into UPS [nexxtech]
>>> 
> 
>> The system 'nut' user can have its password locked - upsd won't consult /etc/passwd for passwords, just for username->uid lookups.
>> 
>> I wonder if there is an extra copy of upsd floating around that is using an old upsd.users file. (Usually it complains that it can't bind to the port, but stranger things have happened.)
> 
> No. I did a full system find and the only upsd is in /usr/sbin and the only *.conf files are in /etc/ups.

I didn't mean to imply there was a second upsd binary on the filesystem - only an extra copy of upsd in memory. It only reads the password file at startup, or after a SIGHUP:

http://www.networkupstools.org/docs/man/upsd.html#_reloading

>> The reason I mention this is that usually there are only two copies of upsmon: one still running as root to call the shutdown command, and one running unprivileged to talk to upsd. They often have similar PIDs (note that the first two differ by one, as do the last two) since upsmon forks early.
> 
> So I added killall upsd upsmon blazer_usb to the bottom of the 'stop' stanza in /etc/rc.d/init.d/ups and did a 'service restart ups'
> 
> As expected, none of those were actually killed, having already been removed. The four instances must have been from my playing around, running the program from the console and (improperly) not using 'service'.
> 
> After the restart ps shows that I have blazer_sub, upsd, upsmon, upsmon as the last threads.
> 
> But I still get the access error from upscmd.
> I tried 'root' (although there was no 'root' user in upsd.users.
> 
> [root at tor2 init.d]# upscmd  nexxtech beeper.toggle
> Username (root):
> Password:		# No password entered
> Unexpected response from upsd: ERR PASSWORD-REQUIRED
> [root at tor2 init.d]# upscmd  nexxtech beeper.toggle
> Username (root):
> Password:		# Usual root password entered
> Unexpected response from upsd: ERR ACCESS-DENIED

Expected.

> [root at tor2 ups]# vim upsd.users
> 
> Added user [root] stanza with password nutpass

Like so?

[root]
	password = nutpass

(The equals sign is required)

> Any further thoughts? I don't (yet) have the source for upsd but it would be interesting to see exactly *what* upsd looks at/for when it checks the user.

http://trac.networkupstools.org/projects/nut/browser/trunk/server/upsd.c#L396

http://trac.networkupstools.org/projects/nut/browser/trunk/server/user.c#L277

> Geoff
> 
> PS. I note that upsc believes that the device manufacture is NEXXTECH not MEC.
> 
> Maybe this unit should be listed in teh Hardware List.

Please see the "Report new devices..." section here:

http://www.networkupstools.org/stable-hcl.html#footnotes


More information about the Nut-upsuser mailing list