Category: Mosquitto

Setup a Mosquitto Password

sudo service mosquitto stop
cd /usr/local/bin
If you already Created a Password & want to change that then using below Command
mosquitto_passwd -D /etc/mosquitto/passwd username
Below Command is for New Password Creation
mosquitto_passwd -c /etc/mosquitto/passwd username
sudo nano /etc/mosquitto/mosquitto.conf
allow anonymous false
#Default authentication and topic access control

#password_file /etc/mosquitto/passwd
 sudo service mosqquitto start
 sudo service mosquitto status

How to Install Mosquitto On Windows

Step 1: Download mosquito from the Download section of


Step 2: It will take you to the Eclipse repository with mirror options through which you can download the exe file.


Step 3: Double clicking the downloaded exe will throw you with the following screen through you might need to download the OpenSSL and pThreads.


Quick Links:



Step 4: Download the Win32 OpenSSL v1.0.2c Light setup file and install it. 


Step 5: The next step would be asking if you want to install the service too, select it and click next


Step 6: Select install location as given below


Step 7: Installation will get progressed once you press Install as given below


Step 8: How to check if Mosquitto broker has started and running? use the command netstat -an from the command prompt


How to Install Mosquitto On Ubuntu

Step 1. Run following command on ec2 instance:-

sudo apt-get install mosquito

sudo apt-get update
 sudo apt-get install pkg-config cmake openssl libc-ares-dev libssl-dev python-mosquitto

sudo apt-get install gcc make g++ libssl-dev


tar xzf mosquitto-1.4.7.tar.gz

cd mosquitto-1.4.7

cmake .
 sudo make install

sudo mkdir /etc/mosquitto

sudo mv /usr/local/etc/mosquitto/mosquitto.conf /etc/mosquitto/mosquitto.conf

Step 2. Run following commands create service mosquitto:-

sudo nano /etc/init/mosquitto.conf

Add following lines to file:-

start on net-device-up
 exec /usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Step 3. Add user to mosquitto:-

cd /usr/local/bin

sudo mosquitto_passwd -c /etc/mosquitto/passwd password