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

安装完成后, 配置文件都在/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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容