mosquitto
mosquitto copied to clipboard
Mosquitto assumes my identity (when on Domain, and same username also exists locally)
C:\Program Files\mosquitto>mosquitto_passwd -c C:\Temp\pwfile testuser
Password:
Reenter password:
C:\Program Files\mosquitto>type c:\Temp\pwfile
Access is denied.
C:\Program Files\mosquitto>whoami
mydomain\my.username
But then when I look a the Properties -> Security for file C:\Temp\pwfile I see: Group or user names: myfullname (myhostname\my.username)
So that's a mismatch -- that shows myhostname\ instead of mydomainname\ .
There does exist on my Windows 11 Pro workstation a Windows local account myusername (or, myhostname\my.username), but I am logged in using my domain account (mydomainname\my.username).
So it appears that mosquitto_passwd sees that a my.username exists locally and sets pwfile to only that user, which is not the user I am logged in as (as I am logged in as the domain account my.username on the domain mydomainname).
Access is denied to that pwfile to not only me, but to my administrator account as well. So I cannot launch mosquitto successfully after creating this pwfile and the mosquitto.conf is configured to use that pwfile that mosquitto_passwd created.
To remedy this, I deleted the local Windows account myhostname\my.username, and the next attempt to do the mosquitto_passwd (as above) did create the pwfile correctly, with my mydomainname\my.username as the entity in Properties -> Security that has the Full control and other permissions.
I understand that this is a corner case, as relatively few people probably have created a local Windows account with the same username as their Domain account, but it probably won't be just me who will run into this.