ASH
ASH

Reputation: 89

Mosquitto Broker on Ubuntu password file error

I'm on Ubuntu 20 and I added a user to mosquitto with password using the following command:

 mosquitto_passwd -c /etc/mosquitto/passwd sammy

but when I try the this command:

 mosquitto -c passwd

I get this error:

1608916934: Error: Unknown configuration variable "sammy:$6$3TcIHaVBfJWi1Vfs$cWYwhaVs8bQdvhQt2gIRP9+P8iV2hldheYgF/nWCiCtN+7sfZP5k9tqXAzKUJBkWE2I9/7QzZhwAuHfseH6F6Q==".
1608916934: Error found at passwd:1.

I'm not sure what is wrong with configuration since it's system generated file?

passwd file content is:

sammy:$6$3TcIHaVBfJWi1Vfs$cWYwhaVs8bQdvhQt2gIRP9+P8iV2hldheYgF/nWCiCtN+7sfZP5k9tqXAzKUJBkWE2I9/7QzZhwAuHfseH6F6Q==

And /etc/mosquitto/conf.d/default.conf content:

allow_anonymous false
password_file /etc/mosquitto/passwd


#listener 1883 localhost

#listener 8883
#certfile /etc/letsencrypt/live/burooq.com/cert.pem
#cafile /etc/letsencrypt/live/burooq.com/chain.pem
#keyfile /etc/letsencrypt/live/burooq.com/privkey.pem


#port 1883
#listener 9001
#listener 8083
#protocol websockets
#certfile /etc/letsencrypt/live/burooq.com/cert.pem
#cafile /etc/letsencrypt/live/burooq.com/chain.pem
#keyfile /etc/letsencrypt/live/burooq.com/privkey.pem

Upvotes: 0

Views: 3706

Answers (1)

romkey
romkey

Reputation: 7089

The -c option tells mosquitto where to find its configuration file. The password file is not the configuration file.

The Unknown configuration variable error message is a pretty big hint about this.

The file /etc/mosquitto/mosquitto.conf is the correct configuration file. As you pointed out in your question, you already added a reference to the password file in /etc/mosquitto/conf.d/default.conf.

Upvotes: 3

Related Questions