MQTT user authentication

Source: Internet
Author: User

Http://emqtt.com/docs/v2/guide.html

1 The default is anonymous authentication, without entering the user name and password, directly can connect

2 How to turn on user name and password Authentication mode

2-1 Turn off Anonymous authentication

Under your MQTT installation directory, go to the folder

Etc/emq.conf Configure enable Anonymous authentication:

# # Allow Anonymous authenticationTrue
()

2-2 Setting up configuration files

User Name Password Authentication

Authentication based on the MQTT login username (username), password (password).

Configure Default User in etc/plugins/emq_auth_username.conf:

Admin public

Enable the Emq_auth_username plugin:

./bin/emqttd_ctl Plugins Load Emq_auth_username

To add a user by using the ./bin/emqttd_ctl Users command:

$./bin/emqttd_ctl Users Add <Username> <Password>

---------------------------------------------------------

After saving, turn on plugin

Finally, each time you modify the configuration file, you need to restart the Mqtt client.

Of course, you can also add new users directly using the command line without restarting Mqtt, but it is not automatically written in the configuration file and is not conducive to future reporting. Know exactly which ones have been used and which are not.


MQTT user authentication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.