Mosquitto username password
What you will learn here about mosquitto username password:
- mosquitto username password or MQTT username password
In order to add security to the MQTT broker, we need to add mosquitto username password or MQTT username password.
If you want to know how to secure mosquitto on Raspberry pi, Linux system and Google cloud please click on below link.
Mosquitto username password
Please follow the following steps to know how to add username and password to mosquitto or MQTT broker.
1)In order to add username and password to the MQTT broker, you need a MQTT broker. If you don’t know how to install MQTT broker please click on the below link.
Install MQTT Broker on Windows
2)Assuming you have installed MQTT broker.
3)Now please open the command prompt in Administrator mode which is shown below.
4)Navigate to your MQTT broker installed folder or path. For navigation use the following command
5)Execute the following command to create username and password file which is shown below
6)Now enter the password which is shown below
7)Now please go to mosquitto installed folder which is shown below
8)Open mosquitto.conf file with any editor
9)Add the following lines with respect to your username and password file which is shown below
password_file usrname_pwd_file_path
10)Now we need to restart mosquitto.
11)Now please execute the following command to stop mosquitto. Please make sure that command prompt is opened in administrator mode
12)Now please execute the following command to stop mosquitto.
13)Now execute the following command to publish data from windows command prompt with username and password.
14)You will receive Connection error: Connection Refused: not authorised error when either username or password or both are wrong.
Please click on the below link to become master in MQTT.