snap mosquitto_passwd Error: Unable to open temporary file. No such file or directory
Hello.
Using latest snap mosquitto 2.0.21
trying to add a user gives an error
[root@wis1 conf.d]# mosquitto_passwd /var/snap/mosquitto/common/conf.d/wis2.passwd testuser Error: Unable to open temporary file. No such file or directory.
backup password file is done but command doesn't even ask for password and user is not added
[root@wis1 conf.d]# ll total 20 -rw-r--r-- 1 root root 213 May 2 10:10 wis2.conf -rwx------ 1 root root 468 Apr 17 18:49 wis2.passwd -rwx------ 1 root root 468 Apr 17 18:49 wis2.passwd.2025-05-14 -rw------- 1 root root 468 May 14 18:17 wis2.passwd.backup.1BxV1V -rw------- 1 root root 468 May 14 18:14 wis2.passwd.backup.9CufH5
Previous mosquitto 2.0.1x versions did work just fine on the same RHEL8 system
Revision in use is 978
mosquitto 2.0.21 978 latest/stable mosquitto✓ -
[root@wis1 ~]# snap info mosquitto name: mosquitto summary: Eclipse Mosquitto MQTT broker publisher: Mosquitto Team (mosquitto✓) store-url: https://snapcraft.io/mosquitto contact: https://mosquitto.org/ license: unset description: | This is a message broker that supports version 5.0, 3.1.1, and 3.1 of the MQTT protocol. MQTT provides a method of carrying out messaging using a publish/subscribe model. It is lightweight, both in terms of bandwidth usage and ease of implementation. This makes it particularly useful at the edge of the network where a sensor or other simple device may be implemented using a microcontroller for example. commands:
- mosquitto.ctrl
- mosquitto.passwd
- mosquitto.pub
- mosquitto.rr
- mosquitto.sub services: mosquitto: simple, enabled, active snap-id: mDxT0cGOHKSs62MOHSK5Ype0Na5UU2LB tracking: latest/stable refresh-date: 18 days ago, at 22:33 UTC channels: latest/stable: 2.0.21 2025-05-01 (978) 3MB - latest/candidate: ↑ latest/beta: ↑ latest/edge: 2.0.21 2025-05-01 (978) 3MB - 1.6/stable: 1.6.15 2022-03-17 (702) 835kB - 1.6/candidate: ↑ 1.6/beta: ↑ 1.6/edge: 1.6.15 2022-07-08 (747) 831kB - installed: 2.0.21 (978) 3MB -
Not sure what "snap" is (please pardon my ignorance) but see if this helps because it sounds like the same problem. You likely need the -c to create the file and -b so passwords can be passed on the command line.
Hello.
Snap is an ubuntu linux packaging system for other distros https://en.wikipedia.org/wiki/Snap_(software)
-c is used to create new files, and this is not the case since it has other users already. -b make sno difference
[root@wis1 conf.d]# mosquitto_passwd -b /var/snap/mosquitto/common/conf.d/wis2.passwd tesuser testpassword Error: Unable to open temporary file. No such file or directory.
there is also some documentation:
https://mosquitto.org/documentation/using-the-snap/
it seems that 2.0.22 has solved this issue
mosquitto 2.0.22 1006 latest/stable mosquitto✓ -
[root@wis1 ~]# mosquitto_passwd /var/snap/mosquitto/common/conf.d/wis2.passwd testuser Password:
Ok great!