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:
Unable to find source-code formatter for language: diff. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
@@ -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