-
-
Save ajumalp/0ad2517d15c999cfc440cdf3d623fab8 to your computer and use it in GitHub Desktop.
From https://synocommunity.com add http://packages.synocommunity.com to your NAS package sources. | |
For that, go to NAS->Package Cnter->Click Settings->Package Sources tab. | |
Then from the community, you can see Mosquitto. Install it. | |
After installing, please stop the Mosquitto service before updating configuration. You can start service after changes. | |
Enable Admin login for Synology | |
Enable SSH in NAS | |
Download putty and connect to NAS Server | |
Login using admin | |
Change to root user [sudo -i, {use admin password}] | |
Find mosquitto.conf file [find / -name mosquitto.conf] | |
Go to that path using cd [in my case cd /volume1/@appstore/mosquitto/var] | |
Edit mosquitto.conf [vi mosquitto.conf] | |
Might say it's used by another process. Force edit. | |
Scroll down and find # allow_anonymous [around line 513] | |
Remove # and make [allow_anonymous false] [Use insert on keyboard to edit] | |
Scroll and find #password_file [around line 555] | |
Remove # and make password_file /volume1/@appstore/mosquitto/var/password_file [where 2nd password_file is the actual filename] | |
Save the file [Esc-> :wq to save] | |
Now create a file password_file in /volume1/@appstore/mosquitto/var/ | |
Ensure your are still in same directory, type vi password_file | |
This will create new file, press insert and type your username and password in below format | |
username:password [Username should not contain :]. You can add multiple users line by line | |
Save file and clseo [Esc->:wq] | |
Find mosquitto_passwd [find / -name mosquitto_passwd] | |
Stay in the mosquitto.conf folder itself. Because we have password_file file here. | |
From mosquitto.conf folder, type mosquitto_passwd [along with path] -U password_file to encrypt password. | |
In my case /volume1/@appstore/mosquitto/bin/mosquitto_passwd -U password_file | |
Start/restart Mosquitto Server | |
All done. Thank You. |
Hey,
doesn't work for me on my DS723+ under DSM 7.2.1
I modified the files /var/packages/mosquitto/var/mosquitto. conf and /var/packages/mosquitto/var/passwd
Encrypted the passwd, open port 1883 on the firewall and start the package.
I have this screen as soon as I click o the Connect button with the error message: Disconnected from server :(
Thank you all to all for the helpful snippets and hints. I am a noob when it comes to mosquitto and shell configuration files. My pitfall was definitely the configuration of the IP address and port on the listener. In my case, mosquitto.conf said
listener 1883 127.0.0.1
and I had no access without an error message in the log. After I entered the IP address of my NAS there, it worked.
This did it for me!
Thanks for the detailed tutorial, my MQTT server is online
To update this slightly for December 2024 and DSM 7.2.
(All the necessary information is in this thread but I thought it would be useful to put it all in one place after a successful installation)
Because of slight path changes in DSM, the original instructions should be changed to:
- From https://synocommunity.com add http://packages.synocommunity.com to your NAS package sources.
- For that, go to NAS->Package Cnter->Click Settings->Package Sources tab.
- Then from the community, you can see Mosquitto. Install it.
- After installing, please stop the Mosquitto service before updating configuration. You can start service after changes.
- Enable Admin login for Synology
- Enable SSH in NAS
- Download putty and connect to NAS Server
- Login using admin
- Change to root user [sudo -i, {use admin password}]
- Go to mosquitto folder: cd /volume1/@appdata/mosquitto
- Edit mosquitto.conf [vi mosquitto.conf]
- Scroll down and find # allow_anonymous [around line 23]
- Remove # and make [allow_anonymous false] [Use insert on keyboard to edit]
- Scroll and find #password_file [around line 26]
15 Remove # and make password_file /volume1/@appdata/mosquitto/password_file - Scroll and find listener 1883 127.0.0.1 [around line 234]
- Change the 127.0.0.1 to the IP address of your NAS
- Save the file [Esc-> :wq to save]
- Now create a file password_file in /volume1/@appdata/mosquitto/
- Ensure your are still in same directory, type vi password_file
- This will create new file, press insert and type your username and password in below format
username:password [Username should not contain :]. You can add multiple users line by line - Save file and clseo [Esc->:wq]
- Type: /volume1/@appstore/mosquitto/bin/mosquitto_passwd -U password_file to encrypt password
- Type: chown sc-mosquitto:synocommunity password_file
- Start/restart Mosquitto Server
It all should work now!
I had to add 'bind_address [NAS IP Address]' to make this work.
just configured and started on my DS224+ with DSM 7.2.2-72806 Update 2, but I only see 1 line into the mosquitto.log file:
Starting mosquitto command /volume1/@appstore/mosquitto/sbin/mosquitto -d -c /volume1/@appdata/mosquitto/mosquitto.conf
How can I verify if it is working or not?
Regards, marco
p.s. tried with bind_address, but terminates in error
just configured an started on my DS224+ with DSM 7.2.2-72806 Update 2, but I only see 1 line into the mosquitto.log file:
Starting mosquitto command /volume1/@appstore/mosquitto/sbin/mosquitto -d -c /volume1/@appdata/mosquitto/mosquitto.conf
How can I verify if it is working or not? Regards, marco p.s. tried with bind_address, but terminates in error
Something in the text was hidden. I changed it now.
with this mosquitto.conf:
listener 1883 192.168.178.62
bind_address 192.168.178.62
the Log Center returns:
System failed to start [Mosquitto].
and mosquitto.log:
Starting mosquitto command /volume1/@appstore/mosquitto/sbin/mosquitto -d -c /volume1/@appdata/mosquitto/mosquitto.conf
1736585298: The 'bind_address' option is now deprecated and will be removed in a future version. The behaviour will default to true.
mosquitto is not running
Mosquitto version is 2.0.20-16
with this mosquitto.conf: listener 1883 192.168.178.62 bind_address 192.168.178.62
the Log Center returns: System failed to start [Mosquitto].
and mosquitto.log: Starting mosquitto command /volume1/@appstore/mosquitto/sbin/mosquitto -d -c /volume1/@appdata/mosquitto/mosquitto.conf 1736585298: The 'bind_address' option is now deprecated and will be removed in a future version. The behaviour will default to true. mosquitto is not running
Mosquitto version is 2.0.20-16
Confirming is not working! I tried all the above configs...Mosquitto failed to start!
no matter what settings I do in the conf file, mosquitto failed to start!
Confirming is not working! I tried all the above configs...Mosquitto failed to start! no matter what settings I do in the conf file, mosquitto failed to start!
please help !!!
So I was able to turn it on in the end...Anyhow is very sensitive!
1-st, I was understanding this step from @AndySmithers incorrectly...
make sure that password_file line from config looks like this "password_file /volume1/@appdata/mosquitto/password_file"...the path is also needed.An if you have multiple networks inside your NAS, listener must be also set with the desired NAS IP!
How can I verify if it is working or not?
OK, tried with default mosquitto.conf 127.0.0.1 and tested with mosquitto_sub/mosquitto_pub commands.
I did configure the log file with these steps:
-
in mosquitto.conf:
- log_type all
- log_dest file /var/log/mosquitto.log
-
in /var/log:
- vi mosquitto.log (and :wq to create the file)
- chown sc-mosquitto:synocommunity mosquitto.log (to assign permissions)
then restart mosquitto and see:
- cat /var/log/mosquitto.log
1738425543: mosquitto version 2.0.20 starting
1738425543: Config loaded from /volume1/@appdata/mosquitto/mosquitto.conf.
1738425543: Opening ipv4 listen socket on port 1883.
1738425543: mosquitto version 2.0.20 running
I had to add 'bind_address [NAS IP Address]' to make this work.
Where did you add this?
I had to add 'bind_address [NAS IP Address]' to make this work.
Where did you add this?
step 16...
"Change the 127.0.0.1 to the IP address of your NAS"
in the config file you have to edit the local address allocated by your router...192.168.1.xxx
Hey @monfiston
you can find the config under
/var/packages/mosquitto/var/