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

 

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

password_file pwfile.example
acl_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



相关文章:

  • 2021-08-29
  • 2021-04-13
  • 2022-12-23
  • 2021-12-18
  • 2022-02-11
  • 2022-01-06
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-05-05
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案