MQTT简介之九--Ubuntu下Mosquitto用户名密码配
2023-01-04 本文已影响0人
醉于麦田
安装完成后, 配置文件都在/etc/mosquitto
目录下
主配置文件mosquitto.conf
sudo touch /etc/mosquitto/pwfile
sudo touch /etc/mosquitto/acl
配置用户验证信息
# 不允许匿名
allow_anonymous false
# 配置用户密码文件
password_file /etc/mosquitto/pwfile
# 配置topic和用户
acl_file /etc/mosquitto/acl
具体配置如下
# 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
allow_anonymous false
password_file /etc/mosquitto/pwfile
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
acl_file /etc/mosquitto/acl