Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Docker container run as root


Lines 88-89 of the Docker file setup the mosquitto user

And the following is from the mosquitto.conf man page:

user username

    When run as root, change to this user and its primary group on startup. If set to "mosquitto" or left unset, and if the "mosquitto" user does not exist, then mosquitto will change to the "nobody" user instead. If this is set to another value and mosquitto is unable to change to this user and group, it will exit with an error. The user specified must have read/write access to the persistence database if it is to be written. If run as a non-root user, this setting has no effect. Defaults to mosquitto.

    This setting has no effect on Windows and so you should run mosquitto as the user you wish it to run as.

    Not reloaded on reload signal.

So since the mosquitto user exists the running instance will drop it's privileges to this user on startup.

So if you want to run as root you can just pass in a `mosquitto.conf` file with `user root`


On 13/05/2021 19:59, mutt wrote:

  I hope this is the right place for this "feature request".

I know it is not a great idea to run as root, but I need to access the cert files (for tls/ssl) in a mounted volume...and these files are 600 owned by root in the host (so also in the container).
If there is an alternative way, I'll appreciate any suggestions.

semi-OT: a my curiosity, why does mosquitto process runs as mosquito user (1883)?

I'm seeing the files:
* <> (no "su" cmd) * <> (no "USER" key) but I don't find out the point where you switch from root to mosquito user (uid 0 to 1883)

I'm not a docker/linux expert :)

Thanks in advance,

mosquitto-dev mailing list
To unsubscribe from this list, visit


Back to the top