# Mosquitto Config File Path on Ubuntu

**URL:** <https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017>\
**Category:** General\
**Created:** [12 January 2021 18:40 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017 "2021-01-12T18:40:07Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![quentinP](https://avatars.discourse-cdn.com/v4/letter/q/ba9def/32.png) [@quentinP](https://discourse.nodered.org/u/quentinP)\
**Post date:** [12 January 2021 18:40 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/1 "2021-01-12T18:40:07Z")

</div>

I'm following [this tutorial](https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-the-mosquitto-mqtt-messaging-broker-on-ubuntu-18-04#prerequisites) 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.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/4/3413bc4b2e1478be113f2adb238e8be3ac7f564a.png)

Do I need to mention the path for my local config file and how do I do it?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [12 January 2021 19:57 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/2 "2021-01-12T19:57:45Z")

</div>

If I remember right, you have to configure a password file and create the users using a command line tool.

The Mosquitto website has all the details.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 January 2021 21:36 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/3 "2021-01-12T21:36:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![quentinP](https://avatars.discourse-cdn.com/v4/letter/q/ba9def/32.png) [@quentinP](https://discourse.nodered.org/u/quentinP)\
**Post date:** [12 January 2021 22:49 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/4 "2021-01-12T22:49:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [13 January 2021 00:32 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/5 "2021-01-13T00:32:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 January 2021 07:27 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/6 "2021-01-13T07:27:37Z")

</div>

> [@quentinP](#):
>
> unfortunately i doesn't

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.

---

<div class="post-metadata">

**Author:** ![quentinP](https://avatars.discourse-cdn.com/v4/letter/q/ba9def/32.png) [@quentinP](https://discourse.nodered.org/u/quentinP)\
**Post date:** [13 January 2021 12:41 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/7 "2021-01-13T12:41:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 January 2021 13:52 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/8 "2021-01-13T13:52:08Z")

</div>

In case you didn't realise it, the 'correct' way to restart mosquitto to get it to read the new config is to use  
`sudo systemctl restart mosquitto`

---

<div class="post-metadata">

**Author:** ![quentinP](https://avatars.discourse-cdn.com/v4/letter/q/ba9def/32.png) [@quentinP](https://discourse.nodered.org/u/quentinP)\
**Post date:** [13 January 2021 16:28 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/9 "2021-01-13T16:28:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![quentinP](https://avatars.discourse-cdn.com/v4/letter/q/ba9def/32.png) [@quentinP](https://discourse.nodered.org/u/quentinP)\
**Post date:** [13 January 2021 19:20 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/10 "2021-01-13T19:20:18Z")

</div>

@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` ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 January 2021 20:01 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/11 "2021-01-13T20:01:21Z")

</div>

It's the same thing, the full name of the file containing the systemd script is`mosquitto.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.

---

<div class="post-metadata">

**Author:** ![quentinP](https://avatars.discourse-cdn.com/v4/letter/q/ba9def/32.png) [@quentinP](https://discourse.nodered.org/u/quentinP)\
**Post date:** [13 January 2021 22:37 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/12 "2021-01-13T22:37:16Z")

</div>

Nice, cheers!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 January 2021 22:37 UTC](https://discourse.nodered.org/t/mosquitto-config-file-path-on-ubuntu/39017/13 "2021-01-27T22:37:22Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
