Name
mosquitto_passwd — manage password files for mosquitto
Synopsis
mosquitto_passwd
[ -H
hash
] [ -c
| -D
] passwordfile
username
mosquitto_passwd
[ -H
hash
] -b
passwordfile
username
password
mosquitto_passwd
-U
passwordfile
Description
mosquitto_passwd is a tool for managing password files for the mosquitto MQTT broker.
Usernames must not contain ":". Passwords are stored in a similar format to crypt(3).
Options
-b
Run in batch mode. This allows the password to be provided at the command line which can be convenient but should be used with care because the password will be visible on the command line and in command history.
-c
Create a new password file. If the file already exists, it will be overwritten.
-D
Delete the specified user from the password file.
-H
Choose the hash to use. Can be one of
sha512-pbkdf2
orsha512
. Defaults tosha512-pbkdf2
. Thesha512
option is provided for creating password files for use with Mosquitto 1.6 and earlier.-U
This option can be used to upgrade/convert a password file with plain text passwords into one using hashed passwords. It will modify the specified file. It does not detect whether passwords are already hashed, so using it on a password file that already contains hashed passwords will generate new hashes based on the old hashes and render the password file unusable.
passwordfile
The password file to modify.
username
The username to add/update/delete.
password
The password to use when in batch mode.
Exit Status
mosquitto_sub returns zero on success, or non-zero on error. If the connection is refused by the broker at the MQTT level, then the exit code is the CONNACK reason code. If another error occurs, the exit code is a libmosquitto return value.
MQTT v3.1.1 CONNACK codes:
0
Success1
Connection refused: Bad protocol version2
Connection refused: Identifier rejected3
Connection refused: Server unavailable4
Connection refused: Bad username/password5
Connection refused: Not authorized
MQTT v5 CONNACK codes:
0
Success128
Unspecified error129
Malformed packet130
Protocol error131
Implementation specific error132
Unsupported protocol version133
Client ID not valid134
Bad username or password135
Not authorized136
Server unavailable137
Server busy138
Banned139
Server shutting down140
Bad authentication method141
Keep alive timeout142
Session taken over143
Topic filter invalid144
Topic name invalid147
Receive maximum exceeded148
Topic alias invalid149
Packet too large148
Message rate too high151
Quota exceeded152
Administrative action153
Payload format invalid154
Retain not supported155
QoS not supported156
Use another server157
Server moved158
Shared subscriptions not supported159
Connection rate exceeded160
Maximum connect time161
Subscription IDs not supported162
Wildcard subscriptions not supported