3

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

ananth:$6$pW5LFAJ/J0bzSHyz$XZsN5MwVc80JqITYvg8qtLxkjWWF2AEzYtoVJpXV9VbjXE5YSXFYC/umWXocj2ScQO/ztFsovgq8o/h00zQTSg==

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 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 – Ananth Sathvick Jul 12 at 18:52
  • Even tried running sudo mosquitto -c /etc/mosquitto/mosquitto.conf – Ananth Sathvick Jul 12 at 18:57
  • What version of mosquitto? and what is the in the logs when the client connects – hardillb Jul 12 at 19:02
  • mosquitto version 1.6.3 and MQTT v3.1.1 broker .Log when the client connects - New client connected from 127.0.0.1 as mosq/Nc2cy7FMx9SI2fab8U (p2, c1, k60). – Ananth Sathvick Jul 12 at 19:04
1

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

Uninstalling

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

Installing

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 )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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