使用身份验证用户名密码设置 Mosquitto MQTT Broker

Mosquitto MQTT Broker setup with authentication username password

我正在尝试在 windows 上使用用户名和密码进行身份验证来配置 Mosquitto MQTT 代理。

我在 mosquitto.conf 文件中添加了以下行:

allow_anonymous 假

用户名测试 remote_username 测试

remote_password 测试 123

当 运行 代理发生以下错误时:

C:\Program Files (x86)\mosquitto>mosquitto.exe -c mosquitto.conf -p 1883 Error: Invalid bridge configuration. Error found at mosquitto.conf:750. Error: Unable to open configuration file.

没有用户名和密码我可以启动代理并连接 MQTTLens 客户端。

谢谢, 阿肖克

remote_usernameremote_password 选项用于配置网桥。您应该查看 password_file 选项。例如

password_file /etc/mosquitto/pwfile

生成文件

mosquitto_passwd -c /etc/mosquitto/pwfile ashok

并添加更多用户

mosquitto_passwd /etc/mosquitto/pwfile guest