可以使用mosquitto自带的mosquitto_passwd命令生成密码文件。

mosquitto_passwd -c [最终生成的password_file文件]  [用户名] 。

#: mosquitto_passwd -c passwd.conf  jinhe_sub

输入命令后,控制台会提示输入新建用户的密码,连续输入两次密码后,则会生成一个passwd.conf文件。

注意,mosquitto_passwd -c命令每次都只会生成只包含一个用户的文件,如果你想在passwd.conf中存放多个用户, 可以使用mosquitto_passwd -b 命令。

mosquitto_passwd -b [最终生成的password_file文件]  [用户名]  [密码]。

mosquitto_passwd -b命令必须在控制台输入明文的密码,且每次只是在passwd.conf中新增一个用户,不会覆盖之前已生成的用户。

同时也可以使用mosquitto_passwd -D命令删除一个用户。

更具体如下:

Name

mosquitto_passwd — manage password files for mosquitto

Synopsis

mosquitto_passwd [ -c | -D ] passwordfile username

mosquitto_passwd -b passwordfile username password

mosquitto_passwd -U passwordfile

Description

mosquitto_passwd is a tool for managing password files the mosquitto MQTT broker.

Usernames must not contain ":". Passwords are stored in a similar format to crypt(3).

Options

-b

Run in batch mode. This allows the password to be provided at the command line which can be convenient but should be used with care because the password will be visible on the command line and in command history.

-c

Create a new password file. If the file already exists, it will be overwritten.

-D

Delete the specified user from the password file.

-U

This option can be used to upgrade/convert a password file with plain text passwords into one using hashed passwords. It will modify the specified file. It does not detect whether passwords are already hashed, so using it on a password file that already contains hashed passwords will generate new hashes based on the old hashes and render the password file unusable.

passwordfile

The password file to modify.

username

The username to add/update/delete.

password

The password to use when in batch mode.

Examples

Add a user to a new password file:

  • mosquitto_passwd -c /etc/mosquitto/passwd ral

Delete a user from a password file

  • mosquitto_passwd -D /etc/mosquitto/passwd ral

Bugs

mosquitto bug information can be found at https://github.com/eclipse/mosquitto/issues

See Also

mosquitto(8) , mosquitto.conf(5) , mqtt(7)

Author

Roger Light <roger@atchoo.org>

MQTT之mosquitto_passwd命令使用相关推荐

  1. BC26 之MQTT协议 AT命令

    AT+CIMI                      //检查SIM卡是否读卡成功. AT+CESQ              //查看信号强度,刚上电入网的时候一般获取信号会比较 慢,可以不断的 ...

  2. 使用MQTT实现简单命令控制

    塞上长城空自许 镜中衰鬓已先斑 前面的博文中已经讲了如何安装MQTT的环境,以及如何进行测试,并给出了一个C语言的小例子.今天再讲讲paho.mqtt.c中一些常用接口的使用以及实现一个命令控制及回显 ...

  3. 物联网-移远M26模块MQTT开发(AT命令)

    MQTT(Message Queuing Telemetry Transport,消息队列遥测传输)是IBM开发的一个即时通讯协议,有可能成为物联网的重要组成部分.该协议支持所有平台,几乎可以把所有联 ...

  4. NBIOT模块 ME3616 AT命令 MQTT 连接 thingsboard

    一.流程 设备复位 AT+ZRSTOK 查询CSQ AT+CSQ+CSQ: 5,0OK 查询注册 AT+CEREG?+CEREG: 0,1OK 设备复位后,插入SIM卡和是否拿到IP,是有主动上报,所 ...

  5. Android 二维码被扫后接收通知(使用MQTT协议实现消息推送)

    现如今扫码付款和收款已经很便利了,比如超市买完东西付款时有两种方式 : 顾客可以出示付款码给收银员扫码收款,也可以由顾客扫描超市的收款码进行付款 .两种方式在付款完成后超市端会进行语音播报收到xx元. ...

  6. Web技术(七):如何使用并实现MQTT 消息订阅-发布模型?

    文章目录 一.什么是发布-订阅消息模型? 二.订阅-发布消息模型有哪些应用? 2.1 应用于IP 物联网络中的消息传递 2.2 应用于操作系统进程间的消息传递 2.3 应用于MESH 自组网中的消息传 ...

  7. 基于ESP32搭建物联网服务器十三(自已搭建一个MQTT服务器)

    在之前的文章中:ESP32搭建WEB服务器十二(使用MQTT协议与ESP32互动)_你的幻境的博客-CSDN博客 我们已经实现了ESP32通过MQTT协议连接到公共MQTT服务器上,但是公共服务器在稳 ...

  8. 【我的物联网成长记17】一条物联网设备控制命令的一生

    [摘要] 一条物联网设备控制命令从诞生到完成使命,它的一生是什么样的?本文将带你解读物联网设备控制命令的完整生命周期. 概述 为能有效地对设备进行管理,设备的产品模型中定义了物联网平台可向设备下发的命 ...

  9. 【MQTT从入门到提高系列 | 01】从0到1快速搭建MQTT测试环境

    这是机器未来的第24篇文章 原文首发地址:https://blog.csdn.net/RobotFutures/article/details/125532208 1. mosquitto概述 Ecl ...

最新文章

  1. Android开发--浅谈ExpandableListActivity
  2. svn: E215004: Authentication failed
  3. maven <type>pom</type><scope>import</scope>
  4. [hdu4333]Revolving Digits
  5. C# 5.0中新增特性
  6. 利用workerman+html开发简单的在线五子棋对战
  7. Python Django jsonpickle序列化隐藏部分字段代码示例
  8. 《贝叶斯方法:概率编程与贝叶斯推断》一导读
  9. express框架日志处理组件morgan
  10. 软件工程师面试学习指南
  11. GPS定位可以使用物联卡吗?信号稳定吗?
  12. fastjson 1.1.31 发布,Java 的 JSON 库
  13. 【背包问题】基于matlab模拟退火算法求解背包问题【含Matlab源码 108期】
  14. pdf转word乱码怎么办,可能是你没用对工具
  15. KETTLE使用教程
  16. 异速联服务器虚拟打印怎么设置,金万维异速联6.2.2.0虚拟打印步骤.doc
  17. 利用Python一键爬取上海二手房信息
  18. HTML中 <img>标签的用法
  19. 岛屿最大面积 leetcode Java_LeetCode:岛屿的最大面积
  20. Update....FROM...

热门文章

  1. 【SpringBoot专题】监控健康状况
  2. Nginx基础——Rewrite规则
  3. 多线程:线程同步的几种方式
  4. java对象重用_JAVA:避免重复的创建对象
  5. 空间刚架matlab_Matlab绘制空间几何图
  6. python和表格关系_数据表之多表关联
  7. 统计123出现次数_如何使用 count 统计词条出现次数?
  8. c# vscode 配置_使用VSCode开发C#项目
  9. ML之API:国内外各大人工智能平台(百度云/华为云/阿里云/Face++等)及其API的简介、使用方法之详细攻略
  10. Python之tkinter:动态演示调用python库的tkinter带你进入GUI世界(Button的command/Label/PhotoImage/封装为类)