Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT 5.0: Authentication with only password does not work with mosquitto_pub. #1274

eerimoq opened this issue May 12, 2019 · 1 comment


None yet
2 participants
Copy link

commented May 12, 2019


The MQTT version 5.0 specification allows a client to send a password
with no user name in the connect packet. The mosquitto_pub, and
probably mosquitto_sub, programs does now support this it seems.

Copied from the specification:

"This version of the protocol allows the sending of a Password with no
User Name, where MQTT v3.1.1 did not. This reflects the common use of
Password for credentials other than a password."

A warning is printed if a password is given but no user name. The password is not sent to the broker.

$ mosquitto_pub -V mqttv5 -t myt -m mym -d -P mypass
Warning: Not using password since username not set.
Client (null) sending CONNECT
Client (null) received CONNACK (0)
Client (null) sending PUBLISH (d0, q0, r0, m1, 'myt', ... (3 bytes))
Client (null) sending DISCONNECT

The command works when both user name and password are given.

$ mosquitto_pub -V mqttv5 -t myt -m mym -d -u myuser -P mypass
Client (null) sending CONNECT
Client (null) received CONNACK (134)
Bad User Name or Password

ralight added a commit that referenced this issue May 21, 2019


This comment has been minimized.

Copy link

commented May 21, 2019

Thanks very much, I've just pushed a change that fixes this and will be part of 1.6.3.

@ralight ralight closed this May 21, 2019

@ralight ralight added this to the 1.6.3 milestone May 21, 2019

ralight added a commit that referenced this issue Jun 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.