美文网首页
MQTT简介之九--Ubuntu下Mosquitto用户名密码配

MQTT简介之九--Ubuntu下Mosquitto用户名密码配

作者: 醉于麦田 | 来源:发表于2023-01-04 15:38 被阅读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

相关文章

网友评论

      本文标题:MQTT简介之九--Ubuntu下Mosquitto用户名密码配

      本文链接:https://www.haomeiwen.com/subject/zjnrcdtx.html