EMQ 修改用户名和密码

步骤一:

vim  /etc/emqx/emqx.conf

 

关闭匿名认证:

mqtt.allow_anonymous = false

步骤二:

通过dashord 或者

 cd /usr/lib/emqx/bin

  ./emqx_ctl plugins load emqx_auth_username

 

加载插件

步骤三:

添加用户名和密码

记得 本次需要明文 需要在 /etc/emqx/plugins/ 中修改文件emqx_auth_username.conf

## Value: plain | md5 | sha | sha256 
auth.user.password_hash = plain

 修改加密方式为明文即可 

步骤四

添加用户 以及密码

./emqttd_ctl users add test 123456

步骤五:

需要重新加载

 

辅助命令

ufw  status

ufw  enable

ufw  disable

 

参看端口占用进程

netstat -tlnp|grep 1883  

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在 Win 版本的 EMQ X 中设置 MQTT 用户名密码,可以按照以下步骤进行操作: 1. 找到 EMQ X 安装目录下的 `etc` 文件夹,进入该文件夹。 2. 打开 `emqx_auth_username.conf` 文件,在文件中添加以下内容: ``` ## auth.username: Enable Authentication with Username/Password ## ## true: Enable username/password authentication ## false: Disable username/password authentication ## ## Value: true, false auth.username = true ## auth.username.default_role: Default User Role ## ## The default role of the user after successful authentication ## ## Value: atom auth.username.default_role = user ## auth.username.password_hash: Password Hashing Algorithm ## ## The algorithm used to hash the password. ## ## Value: plain, md5, sha, sha256, sha512, bcrypt auth.username.password_hash = bcrypt ``` 3. 在 `auth.username.password_hash` 属性中选择密码哈希算法,这里选择 bcrypt 算法,它提供了更好的安全性。 4. 在 `etc` 文件夹中创建一个新的 `emqx_auth_username.conf` 文件,添加以下内容: ``` ## User: test ## ## Password: test ## ## Roles: user ## ## password_hash: bcrypt ## ## 注意:此处为示例,实际使用时应该更改用户名密码 test.$2a$10$u1WuTzCwXQ6ZvMvL0B8QgO5wN5Z5qOwD0xE/3c/UJlHjyI4k9A4g6 ``` 5. 在 `emqx_auth_username.conf` 文件中,为每个用户添加一个条目,包括用户名密码哈希值和角色。 6. 保存文件并重启 EMQ X 服务器,使更改生效。 这样,你就成功地为 Win 版本的 EMQ X 设置了 MQTT 用户名密码

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值