This is my config file /etc/mosquitto/mosquitto.conf

# Place your local configuration in /etc/mosquitto/conf.d/
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

This is my passwd file created using sudo mosquitto_passwd -c /etc/mosquitto/password ananth


This is my local config file present in /etc/mosquitto/conf.d/auth.conf

allow_anonymous false
password_file /etc/mosquitto/password

When I run mosquitto_sub -t test or mosquitto_pub -t test -m "Message", Broker is not refusing the connection due to un authentication

I also tried restarting mosquitto using sudo service mosquitto restart

On Ubuntu 16.04 on oracle virtual machine

Am I missing something ?

  • Run ps -efc | grep mosquitto to check that mosquitto is being run with the -c config option pointing to the config file. iirc mosquitto on 16.04 doesn't default to use the config file
    – hardillb
    Jul 12, 2019 at 18:23
  • Yeah I can see this mosquit+ 15995 1 TS 19 Jul12 ? 00:00:09 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf Jul 12, 2019 at 18:52
  • Even tried running sudo mosquitto -c /etc/mosquitto/mosquitto.conf Jul 12, 2019 at 18:57
  • What version of mosquitto? and what is the in the logs when the client connects
    – hardillb
    Jul 12, 2019 at 19:02
  • mosquitto version 1.6.3 and MQTT v3.1.1 broker .Log when the client connects - New client connected from as mosq/Nc2cy7FMx9SI2fab8U (p2, c1, k60). Jul 12, 2019 at 19:04

3 Answers 3


I also faced the same issue in Ubuntu 18.04. For me, stopping and starting the service worked. Instead of:

sudo service mosquitto restart

I used

sudo service mosquitto stop
sudo service mosquitto start

And I was able to see the effect of changes made in the local config.

Running the status command sudo service mosquitto status gives the following output.

After service restart

mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto; generated)
Active: active (exited) since Wed 2020-03-11 17:36:27 IST; 4s ago
 Docs: man:systemd-sysv-generator(8)
Process: 3884 ExecStop=/etc/init.d/mosquitto stop (code=exited, status=0/SUCCE
Process: 3890 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUC

After service stop and start

mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto; generated)
Active: active (running) since Wed 2020-03-11 17:36:41 IST; 2s ago
 Docs: man:systemd-sysv-generator(8)
Process: 3932 ExecStop=/etc/init.d/mosquitto stop (code=exited, status=0/SUCCE
Process: 3965 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUC
Tasks: 1 (limit: 4915)
CGroup: /system.slice/mosquitto.service
       └─3971 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

After service is restarted using restart, status shows Active: active (exited) and after service stop and start, status shows Active: active (running)

So, I think restarting the service using restart does not reloads the config file and so anything added in local config (in your case, it is /etc/mosquitto/conf.d/auth.conf) does not have any effect.

These were also observed when I made changes in the main config, i.e., /etc/mosquitto/mosquitto.conf and used service restart which had no effect. But, service stop and start worked.


Still Don't know what the problem was but I uninstalled mosquitto* and reinstalled mosquitto*


sudo apt-get remove --auto-remove mosquitto*
sudo apt-get purge --auto-remove mosquitto*


sudo apt install mosquitto*

And this worked for me (Ubuntu 16.04, Oracle Virtual Box(Windows Host), mosquitto version 1.6.3 and MQTT v3.1.1 broker )


I had the same problem, resetting and reinstalling didn't help.

It worked out after I edited my .conf file by adding: listener 1883 localhost

Hope it helps someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.