I followed this tutorial . https://randomnerdtutorials.com/cloud-mqtt-mosquitto-broker-access-anywhere-digital-ocean/
Everything ws ok . But if I modify the configuration file as follows
- at top >> per_listener_settings true
- at bottom >>
allow_anonymous false
listener 1883
password_file /etc/mosquitto/passwd
I get error.
Here is error log
root@mqtt:~# sudo systemctl restart mosquitto
Job for mosquitto.service failed because the control process exited with error code.
See “systemctl status mosquitto.service” and “journalctl -xeu mosquitto.service” for details.
root@mqtt:~# sudo systemctl status mosquitto.service
× mosquitto.service – Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Mon 2024-01-29 03:56:25 UTC; 8s ago
Duration: 4min 45.990s
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Process: 21241 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 21242 ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto (code=exited, status=>
Process: 21243 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
Process: 21244 ExecStartPre=/bin/chown mosquitto:mosquitto /run/mosquitto (code=exited, status=0/SU>
Process: 21245 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=>
Main PID: 21245 (code=exited, status=13)
CPU: 17ms
Jan 29 03:56:25 mqtt systemd[1]: mosquitto.service: Main process exited, code=exited, status=13/n/a
Jan 29 03:56:25 mqtt systemd[1]: mosquitto.service: Failed with result ‘exit-code’.
Jan 29 03:56:25 mqtt systemd[1]: Failed to start mosquitto.service – Mosquitto MQTT Broker.
Jan 29 03:56:25 mqtt systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Jan 29 03:56:25 mqtt systemd[1]: Stopped mosquitto.service – Mosquitto MQTT Broker.
Jan 29 03:56:25 mqtt systemd[1]: mosquitto.service: Start request repeated too quickly.
Jan 29 03:56:25 mqtt systemd[1]: mosquitto.service: Failed with result ‘exit-code’.
Jan 29 03:56:25 mqtt systemd[1]: Failed to start mosquitto.service – Mosquitto MQTT Broker.
Hello mosaddeq,
You’ll also need to follow the instructions to Enable Remote Access and add Authentication, read the section “Mosquitto Broker Enable Remote Access (Authentication: user and password)”