Search code examples
mqttmosquitto

Mosquitto broker authentification even for same machine clients


I am working on a MQTT project using local mosquitto broker.

Currently for testing, I want my broker to require authentication even from same machine clients. But it looks like the broker is allowing them even if they don't have the username or the password.

my mosquitto.conf:

allow_anonymous true
password_file C:\Documents\...\password_file.txt

Solution

  • For Mosquitto v2.0.x and newer just remove the allow_anonymous true or set it to false (for previous versions)

    When set to true mosquitto will allow clients to connect without a username or password.