I am trying to subscribe to a mosquitto server that I installed and configured with this command

mosquitto_sub -h myserver.myserver.myserver -p 9500 -t "test" -u "myuser" -P "my-correct-password" --capath /etc/ssl/certs/

Where I substituted my actual values for myserver.myserver.myserver, myuser and my-correct-password. When I run this command, my terminal doesn't give any response. It doesn't even disconnect after waiting for a long time.

However, if I replace my-correct-password with a password I know is incorrect, I get the response Connection Refused: not authorised. How come I can't subscribe to the mosquitto server with a correct password? And how come I only get a response from the server if I supply an erroneous password?

I can't remember this being a problem in the past...I'm pretty sure I ran this command successfully in the past.


From all the available information in the question, the 2 simplest options.

  1. There are no messages being published on the topic subscribed to.
  2. There is an ACL in place on the broker and the user is not authorised to see messages on the topic subscribed to.

Add -d to the command line to see if the connection and the subscription actually complete successfully.

  • Thanks Item 1 was my issue
    – John
    Dec 1 '20 at 12:43
  • @John in that case, please accept this answer. Dec 22 '20 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.