MQTT服务器搭建--Mosquitto用户名密.... .... 0000 0101 = Connection Ack: Connection Refused: not authorized (5)

做一个mqtt东西,服务也搭建好了,本地测试也没问题,关键是从别人拿来的板子上传东西怎么都发布不了命令。
通过抓包发现请求连接mqtt服务的时候握手失败connedtion ACK返回:
…. …. 0000 0101 = Connection Ack: Connection Refused: not authorized (5)
没有权限,设置了可以匿名访问的啊;后来发现板子发来的信息带了默认的用户名密码导致,mqtt服务端进行了验证权限问题而不通!
这里写图片描述
解决方法:给mqtt服务添加相应的用户名密码即可,添加方法参考
https://blog.csdn.net/u012377333/article/details/69397124

2.添加用户信息

添加用户’aaa’密码’aaa‘,

#mosquitto_passwd -c /etc/mosquitto/pwfile aaa

猜你喜欢

转载自blog.csdn.net/weixin_43025071/article/details/82502094