Giter VIP home page Giter VIP logo

Comments (9)

dirkmoors avatar dirkmoors commented on September 18, 2024

Possible duplicate of: moby/moby#3124

from docker-ejabberd.

dirkmoors avatar dirkmoors commented on September 18, 2024

What I understand is that Docker considers 'bind-mounts' as being owned by 'root' user, which would explain why our 'ejabberd' user does not get access to the volume.

from docker-ejabberd.

dirkmoors avatar dirkmoors commented on September 18, 2024

@rroemhild Would you consider it an option to change the default user to 'root', and ditch the 'ejabberd' user? See: #58

from docker-ejabberd.

rroemhild avatar rroemhild commented on September 18, 2024

Run ejabberd with the root user removes a bit of security. What about change the directory owner:group to the ejabberd id (999) or set read/write permissions for others?

from docker-ejabberd.

rroemhild avatar rroemhild commented on September 18, 2024

Or use a data-container and set the correct ownership:

$ docker create -v /opt/ejabberd/database -v /opt/ejabberd/ssl --name ejabberd-data debian
$ docker run --rm --volumes-from ejabberd-data debian chown -R 999:999 /opt/ejabberd
$ docker run -d --name ejabberd --volumes-from ejabberd-data rroemhild/ejabberd

from docker-ejabberd.

dirkmoors avatar dirkmoors commented on September 18, 2024

@rroemhild I would rather not work with a data container (although it SHOULD be possible ofcourse), since I want to make sure the data persists in production. Changing directory permissions on the host to a user that only exists in a container seems counter-intuitive. If there would be a way for the non-root user to write a mounted directory on the host, that would work for me too. In the meanwhile, I'm pretty much stuck...

from docker-ejabberd.

sunsided avatar sunsided commented on September 18, 2024

Heya. I stumpled over this very sample problem. Since you already use startup scripts, I'd like to suggest something like the following:

We could have a EJABBERD_UID environment variable, possibly preset to 999 in the Dockerfile. On run - as root - perform a

usermod -u $EJABBERD_UID $EJABBERD_USER

to change the ejabberd user's UID on the fly. The permissions on all owned directories and files should be changed automatically. After that, continue on as $EJABBERD_USER.

I assume it might also be possible to install sudo in the dockerfile, add a change-user.sh script that does the above and then configure passwordless sudo access to this file only, removing the need to run as root if that isn't feasible.

from docker-ejabberd.

rroemhild avatar rroemhild commented on September 18, 2024

@sunsided thanks for your contribution You got me on the right track. Can you both review PR #66, please. The container must be started with the -u root option.

from docker-ejabberd.

rroemhild avatar rroemhild commented on September 18, 2024

I merged the PR to master branch. It works for me and I think it addresses this problem by let the user decide to run ejabberd as root but run with ejabberd user by default. Feel free to re-open this issue.

from docker-ejabberd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.