[SERVER-18581] The Ubuntu package should start the mongod with group=mongodb Created: 20/May/15  Updated: 18/May/16  Resolved: 18/Aug/15

Status: Closed
Project: Core Server
Component/s: Packaging
Affects Version/s: 2.6.10
Fix Version/s: 2.6.13, 3.0.7, 3.1.7

Type: Bug Priority: Major - P3
Reporter: Joanna Cheng Assignee: Ernie Hershey
Resolution: Done Votes: 0
Labels: build-planning, mms-s
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Operating System: Linux
Backport Completed:
Sprint: Build 5 06/26/16, Build 6 07/17/15, Build 7 08/10/15, Build 8 08/31/15, Build 15 (06/03/16)
Participants:

 Description   

When you start the mongod as a service, it starts with user=mongodb and group=nogroup. This can be seen from the file permissions in /proc/pid

root@genique:~# ls -la /proc/28109
total 0
dr-xr-xr-x   9 mongodb nogroup 0 May 20 12:54 ./
dr-xr-xr-x 386 root    root    0 May  6 17:48 ../
dr-xr-xr-x   2 mongodb nogroup 0 May 20 14:15 attr/
-rw-r--r--   1 mongodb nogroup 0 May 20 14:15 autogroup
-r--------   1 mongodb nogroup 0 May 20 14:15 auxv
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 cgroup
--w-------   1 mongodb nogroup 0 May 20 14:15 clear_refs
-r--r--r--   1 mongodb nogroup 0 May 20 12:54 cmdline
-rw-r--r--   1 mongodb nogroup 0 May 20 14:15 comm
-rw-r--r--   1 mongodb nogroup 0 May 20 14:15 coredump_filter
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 cpuset
lrwxrwxrwx   1 mongodb nogroup 0 May 20 13:09 cwd -> /
-r--------   1 mongodb nogroup 0 May 20 14:13 environ
lrwxrwxrwx   1 mongodb nogroup 0 May 20 12:54 exe -> /usr/bin/mongod
dr-x------   2 mongodb nogroup 0 May 20 12:54 fd/
dr-x------   2 mongodb nogroup 0 May 20 13:09 fdinfo/
-rw-r--r--   1 mongodb nogroup 0 May 20 14:15 gid_map
-r--------   1 mongodb nogroup 0 May 20 14:15 io
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 latency
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 limits
-rw-r--r--   1 mongodb nogroup 0 May 20 14:15 loginuid
-r--r--r--   1 mongodb nogroup 0 May 20 13:09 maps
dr-x------   2 mongodb nogroup 0 May 20 14:15 map_files/
-rw-------   1 mongodb nogroup 0 May 20 14:15 mem
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 mountinfo
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 mounts
-r--------   1 mongodb nogroup 0 May 20 14:15 mountstats
dr-xr-xr-x   7 mongodb nogroup 0 May 20 14:15 net/
dr-x--x--x   2 mongodb nogroup 0 May 20 14:15 ns/
-r--r--r--   1 mongodb nogroup 0 May 20 12:54 numa_maps
-rw-r--r--   1 mongodb nogroup 0 May 20 14:15 oom_adj
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 oom_score
-rw-r--r--   1 mongodb nogroup 0 May 20 12:54 oom_score_adj
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 pagemap
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 personality
-rw-r--r--   1 mongodb nogroup 0 May 20 14:15 projid_map
lrwxrwxrwx   1 mongodb nogroup 0 May 20 13:09 root -> /
-rw-r--r--   1 mongodb nogroup 0 May 20 14:15 sched
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 schedstat
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 sessionid
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 smaps
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 stack
-r--r--r--   1 mongodb nogroup 0 May 20 12:54 stat
-r--r--r--   1 mongodb nogroup 0 May 20 12:54 statm
-r--r--r--   1 mongodb nogroup 0 May 20 12:54 status
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 syscall
dr-xr-xr-x  20 mongodb nogroup 0 May 20 14:15 task/
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 timers
-rw-r--r--   1 mongodb nogroup 0 May 20 14:15 uid_map
-r--r--r--   1 mongodb nogroup 0 May 20 14:15 wchan

Can this be changed to also start with group=mongodb? The relevant change in the init.d script is:

@@ -28,6 +28,7 @@
   CONF=/etc/mongod.conf
   DAEMON=/usr/bin/mongod
   DAEMONUSER=${DAEMONUSER:-mongodb}
+  DAEMONGROUP=${DAEMONGROUP:-mongodb}
 
   if [ -f /etc/default/mongod ]; then . /etc/default/mongod; fi
 
@@ -45,6 +46,6 @@
 
   if [ "x$ENABLE_MONGOD" = "xyes" ]
   then
-    exec start-stop-daemon --start --chuid $DAEMONUSER --exec $NUMACTL $DAEMON $DAEMON_OPTS
+    exec start-stop-daemon --start --chuid $DAEMONUSER:$DAEMONGROUP --exec $NUMACTL $DAEMON $DAEMON_OPTS
   fi
 end script



 Comments   
Comment by Githook User [ 23/Sep/15 ]

Author:

{u'username': u'ehershey', u'name': u'Ernie Hershey', u'email': u'ernie.hershey@10gen.com'}

Message: SERVER-18581 Start process with group=mongodb in .deb packages

(cherry picked from commit add69c51cf4469ec44db4bae7d21c25da23adbe2)
Branch: v3.0
https://github.com/mongodb/mongo/commit/96f2d47ca3eff2f945f8f07faf14b323db319206

Comment by Githook User [ 18/Aug/15 ]

Author:

{u'username': u'ehershey', u'name': u'Ernie Hershey', u'email': u'ernie.hershey@10gen.com'}

Message: SERVER-18581 Start process with group=mongodb in .deb packages
Branch: master
https://github.com/mongodb/mongo/commit/add69c51cf4469ec44db4bae7d21c25da23adbe2

Comment by Ernie Hershey [ 18/Aug/15 ]

Reproduced in Ubuntu 12.04 and Debian 7.1 and tested the fix.

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