| MOSQUITTO_CTRL(1) | Commands | MOSQUITTO_CTRL(1) |
NAME¶
mosquitto_ctrl - a tool for initialising/configuring a Mosquitto broker instance
SYNOPSIS¶
mosquitto_ctrl [options | -o config-file] module-name module-command [command-options]
options: [auth-options] [connection-options] [mqtt-options] [output-options] [tls-certificate-options | tls-psk-options]
auth-options:
[-u username] [-P password]
connection-options:
{[-h hostname] [--unix socket path] [-p port-number]
| -L URL}
[-A bind-address]
[--proxy socks-url]
mqtt-options:
[-c] [-i client-id]
[-q message-QoS]
[-V protocol-version]
output-options:
[-d] [--quiet]
tls-certificate-options:
[--no-tls]
{--cafile file | --capath dir}
[--tls-use-os-certs]
[--cert file] [--key file]
[--ciphers ciphers] [--insecure]
[--tls-alpn protocol]
[--tls-keylog file]
[--tls-version version]
[--tls-engine engine]
[--keyform {pem | engine}]
[--tls-engine-kpass-sha1 kpass-sha1]
tls-psk-options:
--psk hex-key
--psk-identity identity
[--ciphers ciphers]
[--tls-version version]
mosquitto_ctrl [connection-options] (interactive shell mode)
mosquitto_ctrl [--help]
DESCRIPTION¶
mosquitto_ctrl is a tool for helping configure a Mosquitto broker instance.
It can be run primarily as a straightforward command line tool, as described here, or as an interactive shell as described in mosquitto_ctrl_shell(1). The interactive shell makes most operations very straightforward and is recommended for ease of use.
ENCRYPTED CONNECTIONS¶
mosquitto_ctrl supports TLS encrypted connections. It is strongly recommended that you use an encrypted connection for all remote use of mosquitto_ctrl.
To enable TLS connections when using x509 certificates, one of either --cafile or --capath must be provided as an option.
To enable TLS connections when using TLS-PSK, you must use the --psk and the --psk-identity options.
MODULES¶
Dynamic security
External modules
CONNECTION OPTIONS¶
The options below may be given on the command line, but may also be placed in a config file located at $XDG_CONFIG_HOME/mosquitto_ctrl or $HOME/.config/mosquitto_ctrl.
The config file may be specified manually with the -o config-file option.
The config file should have one pair of -option value per line. The values in the config file will be used as defaults and can be overridden by using the command line. The exceptions to this are the message type options, of which only one can be specified. Note also that currently some options cannot be negated, e.g. -S. Config file lines that have a # as the first character are treated as comments and not processed any further.
-A
--cafile
See also --capath
--capath
For --capath to work correctly, the certificate files must have ".crt" as the file ending and you must run "openssl rehash <path to capath>" each time you add/remove a certificate.
See also --cafile
--cert
See also --key and the Encrypted Connections section.
--ciphers
-d, --debug
-D, --property
-D command identifier value
-D command identifier name value
command is the MQTT command/packet identifier and can be one of CONNECT, PUBLISH, PUBACK, PUBREC, PUBCOMP, SUBSCRIBE, UNSUBSCRIBE, DISCONNECT, AUTH, or WILL. The properties available for each command are listed in the Properties section.
identifier is the name of the property to add. This is as described in the specification, but with '-' as a word separator. For example: payload-format-indicator. More details are in the Properties section.
value is the value of the property to add, with a data type that is property specific.
name is only used for the user-property property as the first of the two strings in the string pair. In that case, value is the second of the strings in the pair.
--help
-h, --host
-i, --id
--insecure
--key
See also --cert and the Encrypted Connections section.
--keyform
See also --tls-engine.
-L, --url
Depending on the scheme, the port will default to different values. mqtt:// - 1883, mqtts:// - 8883, ws:// - 80, wss:// - 443.
--nodelay
-o config-file
-p, --port
-P, --pw
See also the --username option.
--proxy
If username is not given, then no authentication is attempted. If the port is not given, then the default of 1080 is used.
If the host is given as an IPv6 address, it must be enclosed in square brackets, e.g. socks5h://[::1]:1080. Note that square brackets have special meaning in some shells, so the proxy url may need quoting in double or single quotes.
More SOCKS versions may be available in the future, depending on demand, and will use different protocol prefixes as described in curl(1).
--psk
--psk-identity
-q, --qos
--quiet
--tls-alpn
--tls-engine
See also --keyform.
--tls-engine-kpass-sha1
See also --tls-engine.
--tls-use-os-certs
--tls-version
-u, --username
See also the --pw argument.
--unix
See the socket_domain option in mosquitto.conf(5) to configure Mosquitto to listen on a unix socket.
-V, --protocol-version
PROPERTIES¶
The -D / --property option allows adding properties to different stages of the mosquitto_ctrl run. The properties supported for each command are as follows:
Connect¶
Publish¶
Disconnect¶
Will properties¶
EXIT STATUS¶
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:
MQTT v5 CONNACK codes:
Other codes:
ENVIRONMENT VARIABLES¶
MOSQUITTO_UNSAFE_ALLOW_SYMLINKS
BUGS¶
mosquitto bug information can be found at https://github.com/eclipse-mosquitto/mosquitto/issues
SEE ALSO¶
mosquitto(7), mqtt(7), mosquitto_ctrl_shell(1), mosquitto_rr(1), mosquitto_pub(1), mosquitto_sub(1), mosquitto(8), libmosquitto(3), mosquitto-tls(7)
AUTHOR¶
Roger Light <roger@atchoo.org>
| 05/14/2026 | Mosquitto Project |