title: Starting mongod fails unless run as root
body: <p>I am able to start my mongo server with the following command:</p>
  
  <pre><code>[lucas@ecoinstance]~/node/nodetest2$ sudo mongod --dbpath /home/lucas/node/nodetest2/data
   --fork --logpath /var/log/mongodb/mongod-nodetest2.log                                  
  about to fork child process, waiting until server is ready for connections.
  forked process: 10293
  child process started successfully, parent exiting
  </code></pre>
  
  <p>but when I try to remove the <code>sudo</code>, I get the following error:</p>
  
  <pre><code>[lucas@ecoinstance]~/node/nodetest2$ mongod --dbpath /home/lucas/node/nodetest2/
  data --fork --logpath /var/log/mongodb/mongod-nodetest2.log
  about to fork child process, waiting until server is ready for connections.
  forked process: 10284
  ERROR: child process failed, exited with error number 1
  </code></pre>
  
  <p>Here is additional information:</p>
  
  <pre><code>[lucas@ecoinstance]~/node/nodetest2$ ls -l data/*
  -rw------- 1 mongodb mongodb 67108864 Jun  7 20:57 data/local.0
  -rw------- 1 mongodb mongodb 16777216 Jun  7 20:57 data/local.ns
  -rwxr-xr-x 1 mongodb mongodb        6 Jun  7 20:57 data/mongod.lock
  -rw------- 1 mongodb mongodb 67108864 Jun  7 02:08 data/nodetest1.0
  -rw------- 1 mongodb mongodb 16777216 Jun  7 02:08 data/nodetest1.ns
  -rw------- 1 mongodb mongodb 67108864 Jun  7 23:01 data/nodetest2.0
  -rw------- 1 mongodb mongodb 16777216 Jun  7 23:01 data/nodetest2.ns
  
  data/journal:
  total 3145744
  -rw------- 1 mongodb mongodb 1073741824 Jun  7 23:01 j._0
  -rw------- 1 root    root            88 Jun  7 23:01 lsn
  -rw------- 1 mongodb mongodb 1073741824 Jun  6 03:10 prealloc.1
  -rw------- 1 mongodb mongodb 1073741824 Jun  6 03:12 prealloc.2
  
  [lucas@ecoinstance]~/node/nodetest2$ ls -l /etc/mongod.conf 
  -rw-r--r-- 1 mongodb mongodb 1701 May  5 15:07 /etc/mongod.conf
  
  [lucas@ecoinstance]~/node/nodetest2$ ls -l /var/log/mongodb/
  total 120
  -rw-r--r-- 1 mongodb mongodb 96801 Jun  7 05:48 mongod.log
  -rw-r--r-- 1 root    root    15625 Jun  8 00:18 mongod-nodetest2.log
  -rw-r--r-- 1 mongodb mongodb  2805 Jun  7 20:38 mongod-nodetest2.log.2014-06-07T20-57-47
  </code></pre>
  
  <p>I cannot find a similar problem. What is the cause of this issue?</p>
  
  <p><strong>Update</strong>
  Thanks to Asya's answer below, I ran a similar command, but changed the location of the log file to one which does not need root access privileges:</p>
  
  <pre><code>mongod --dbpath /home/lucas/node/nodetest2/data --fork --logpath /home/lucas/data/log/mongodb/mongod-nodetest2.log
  </code></pre>
  
  <p>I also encountered an issue where <code>mongod</code> was running in the background, similar to <a href="https://stackoverflow.com/questions/6478113/unable-to-start-mongodb-local-server">this question</a>. Stopping that process before running the above command worked for me.</p>
  
  <p>Thanks Asya!</p>