net usershare dies for users with "Failed to init messaging context"

Jeremy Allison jra at
Mon Jun 5 17:51:10 UTC 2017

On Mon, Jun 05, 2017 at 11:09:12AM -0600, David Mulder via samba-technical wrote:
> > net usershare add test_share /home/dmulder/test_share/
> Failed to init messaging context
> I've been looking at this and thinking this might be due to hardening
> done after the badlock fixes. Any thoughts? Maybe this is a known issue?
> It only fails for regular users, not for root.
> Debug:
> pm_process() returned Yes
> lp_servicenumber: couldn't find homes
> messaging_dgm_lockfile_create: open failed: Permission denied
> messaging_dgm_init: messaging_dgm_create_lockfile failed: Permission denied
> messaging_dgm_ref: messaging_dgm_init returned Permission denied
> messaging_dgm_init failed: Permission denied
> messaging_dgm_ref failed: Permission denied
> Failed to init messaging context

That's normal for a non-root usage of the net client binary.

In 4.5.x we have:

         * Failing to init the msg_ctx isn't a fatal error. Only root-level
         * things (joining/leaving domains etc.) will be denied.
        c->msg_ctx = messaging_init(c, samba_tevent_context_init(c));

in 4.6 and above (master) we have:

        status = messaging_init_client(c,
        if (geteuid() != 0 &&
                        NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
                 * Normal to fail to initialize messaging context
                 * if we're not root as we don't have ability to
                 * read lock directory.
                DBG_NOTICE("Unable to initialize messaging context. "
                        "Must be root to do that.\n");
        } else if (!NT_STATUS_IS_OK(status)) {
                d_fprintf(stderr, "Failed to init messaging context\n");

Is you testing in 4.5.x or 4.6.x ?

More information about the samba-technical mailing list