mosquitto的acl及用户配置

来源:互联网 发布:linux rm -rf 命令撤回 编辑:程序博客网 时间:2024/05/22 17:19

mosquitto的acl规则及用户配置信息真让人头疼啊.折腾了半天才搞明白,随手记下来,省的下次又忘了.

 

首先mosquitto.conf中设置acl配置文件及用户配置文件:

password_file pwfile.exampleacl_file aclfile.example


pwfile.example为用户列表

aclfile.example为访问规则列表

 

在pwfile.example中需要以usernme/password格式添加相关用户

#发布信息用户pub/pub#接收信息用户sub/sub


然后在aclfile.example文件中配置用户可访问的topic信息

复制代码
#用户信息user pub#用户可访问的topic,这里为可读可写topic mytopic/news#订阅用户可访问权限user sub#这里为只读topic read mytopic/news
复制代码
原创粉丝点击