Hive mq ce deployment, how to setup username and password

we have install hivemq community edition using docker.

#docker run --name hivemq-ce -d -p 1883:1883 hivemq/hivemq-ce

so, could you please help us in setting up the username and password for the below

con -i client -h abc.com

we have setup username and password under config.xml

config.xml

<?xml version="1.0"?> 1883 0.0.0.0 8000 0.0.0.0 /mqtt my-websocket-listener mqttv3.1 mqtt true tib tib@123 root@abe16fd898d3:/opt/hivemq-ce-2024.1/conf#

→ in mqtt cli
we are executing as below
mqtt> con -i client -h qamqtt.tibchannels.com → but still it does not ask for username and password

Hi @raheem12

Welcome to the HiveMQ Community! We are delighted to see your interest in MQTT and the HiveMQ broker, and we sincerely appreciate your participation in our community.

If you are seeking to implement simple authentication (username and password) for MQTT clients, particularly those connecting to the broker using mqtt-cli, you’ll need to install a Security Extension. A great option is the open-source HiveMQ File RBAC Extension, available for download at HiveMQ Extension - File RBAC. Comprehensive configuration instructions can be found at GitHub - hivemq/hivemq-file-rbac-extension: HiveMQ extension for managing role-based authorization.

Should you have any questions or require further assistance, please feel free to reach out. We’re here to help and look forward to supporting you in your MQTT journey.

Best regards,
Dasha from HiveMQ Team

Dear Team,

Thank you so much for the reply, it worked.

But when i connect without username and password, it should not connect but it gets connected. how to resolve this issue?

So we want to connect with only username and password and not without it. Could you please help me here.

mqtt> con -h abc.com -i client
client@abc.com>

Thanks & Regards,
Mohammed.Raheem

Hi @raheem12

Check the directory $HIVEMQ_HOME/extensions/hivemq-allow-all-extension. If there is no file with the filename "DISABLED" in the directory, the extension is enabled and any client can authenticate. To disable the extension, create the file with the filename "DISABLED" in the directory.
Documentation: https://docs.hivemq.com/hivemq/latest/extensions/general.html#enable-disable-extensions

cd $HIVEMQ_HOME/extensions/hivemq-allow-all-extension
touch DISABLED

Watch the hivemq.log for the message:

INFO  - Extension "Allow All Extension" version 1.0.0 stopped successfully.

Then test your mqtt client again.
I hope it helps.
Dasha from HiveMQ Team

Dear Team,

There is one more query.

https://www.hivemq.com/demos/websocket-client/ → while connecting through web socket

host: qa.com
port: 1883
ClientID: what should be clienID , from where should i pick it
username: abc
password: abc@123

Could you please help in setting ClienID

when connecting through mqtt cli it will not ask for ClienID

Thanks & Regards,
Mohammed.Raheem

Hi @raheem12

Thank you for reaching out with your question. When connecting to an MQTT broker using the MQTT-CLI client, the Client ID is specified with the -i (--identifier) option, as you’ve correctly pointed out in your example:

In your example, you have set the Client ID = “client”.

I hope this clarifies your query. Should you have any further questions or need additional assistance, please don’t hesitate to let us know.

Best regards,
Dasha from HiveMQ Team