Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-12807

Debian package will fail to create mongodb user if another user exists with the word "mongodb" as part of its name

    • Server Development Platform
    • ALL

      The postinst script for mongodb 2.4.9 has the following:

      case "$1" in
          configure)
              # create a mongodb group and user
              if ! grep -q mongodb /etc/passwd; then
                      adduser --system --no-create-home mongodb
                      addgroup --system mongodb
                      adduser mongodb mongodb
              fi
      

      grep -q mongodb will succeed if any user exists that has "mongodb" as part of its name. In regex parlance, the grep is not anchored.

      In particular, if the mongodb-mms-backup-agent package is installed first, it will create a mongodb-mms-agent user. Then if mongodb is installed after, it will fail to create a mongodb user as grep -q mongodb will match on mongodb-mms-agent.

      You might consider running /usr/bin/id mongodb >/dev/null 2>&1 and checking the return code.

            Assignee:
            backlog-server-devplatform [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
            Reporter:
            tim.olsen@mongodb.com Timothy Olsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: