[SERVER-23516] Using apt-get update chowns user to mongodb Created: 04/Apr/16  Updated: 06/Dec/17  Resolved: 22/May/17

Status: Closed
Project: Core Server
Component/s: Packaging
Affects Version/s: 3.2.0
Fix Version/s: 3.4.10, 3.5.8

Type: Improvement Priority: Major - P3
Reporter: Rachelle Palmer Assignee: Ramon Fernandez Marina
Resolution: Done Votes: 1
Labels: bkp
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-29686 Remove /var/lib/mongodb from mongodb-... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v3.4, v3.2, v3.0
Participants:
Case:

 Description   

Running apt-get update on the servers used by Ops Manager can have the sad consequence of changing the owner to the mongodb user from mongodb-mms user, potentially breaking backups for customers. The bit of code for the package that seems to apply here:

Post-install:
# create a mongodb group and user
if ! getent passwd mongodb >/dev/null 2>&1; then
adduser --system --no-create-home mongodb
addgroup --system mongodb
adduser mongodb mongodb
fi
 
# create db -- note: this should agree with dbpath in mongod.conf
mkdir -p /var/lib/mongodb
chown -R mongodb:mongodb /var/lib/mongodb
 
# create logdir -- note: this should agree with logpath in mongod.conf
mkdir -p /var/log/mongodb
chown -R mongodb:mongodb /var/log/mongodb

However, mongod is running as the mongodb-mms user (because Ops Manager's default user is mongodb-mms). Suggestion: chown if the directories don't previously exist, else no chown.

(opened per request of ernie.hershey)



 Comments   
Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'ramonfm', 'name': u'Ramon Fernandez', 'email': u'ramon@mongodb.com'}

Message:SERVER-23516 Packages should not modify permissions when dbpath exists

(cherry picked from commit cb1ea2ad2254ad9794138c366ef8737443dfc348)
Branch:v3.4
https://github.com/mongodb/mongo/commit/a1fec289811ca10143d52c5106dcf222cc6fd872

Comment by Githook User [ 22/May/17 ]

Author:

{u'name': u'Ramon Fernandez', u'email': u'ramon@mongodb.com'}

Message: SERVER-23516 Packages should not modify permissions when dbpath exists
Branch: master
https://github.com/mongodb/mongo/commit/cb1ea2ad2254ad9794138c366ef8737443dfc348

Generated at Thu Feb 08 04:03:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.