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