I'm following this tutorial to configure mosquitto. This means that I'm storing my local configuration in /etc/mosquitto/conf.d/default.conf. However, I've just now realized that I can put any password/username and it will access mosquitto meaning my config file isn't taken into account. I've just now discovered the /etc/mosquitto.conf and it looks like this.
The line include_dir /etc/mosquitto/conf.d
means that it looks in that folder and will include any config files, adding them on to the end of the default file. So it should be using yours. Best not to call yours default.conf though, to avoid confusion.
I know, unfortunately i doesn't ... How does mosquitto do when there are multiple .conf files in the dir? Surely you need to specify a file no? Could that be the problem?
They are handled in the same way as other Linux/Unix conf files. The files in the .d folder are loaded in alphabetical order typically. You can put leading numbers to help order them "00"-"99" for example.
Again, the Mosquitto web site should have all the details you need.
Assuming you have checked the docs as suggested, show us what is in that file, and any other conf files in that folder, and tell us what you have done to setup the users and passwords.
Hey, thank you all for the help!! Turns out that mosquitto was running in the background and that it wasn't reading the new config files. I killed the background process and ran it again running the new config file in daemon version.
Yeah, weird thing is that I've been unsing that method. I thought that it might be because the .init file for mosquitto was pointing towards the wrong dir but no. So i always launch mosquitto by speciftying the config path now and it works
@Colin actually, because I'm running mosquitto as daemon version does that mean I need to run sudo systemctl restart mosquitto.service instead of sudo systemctl restart mosquitto ?
It's the same thing, the full name of the file containing the systemd script ismosquitto.service but you don't need the full name. In fact of you start typing the name then hit tab it will complete it for you which is often useful when you are not sure of the service name.