starting mongod as non-root user

550 views
Skip to first unread message

Raghava Mutharaju

unread,
Jan 1, 2015, 12:52:58 PM1/1/15
to mongod...@googlegroups.com
Hi,

I am using MongoDB 2.8.0-rc4 on AWS EC2. When I try to start mongod as a non-root user, I get the following message

about to fork child process, waiting until server is ready for connections.
forked process: 2503
ERROR: child process failed, exited with error number 1

No log is created. 

If I start with root then the only relevant message in the log is that I started as a root user and that it is not recommended.

I assigned mongod:mongod (user, group) to dbpath, logpath and to mongod executable as well. 

How should I start mongod as a non-root user? 

Also, how do I shutdown mongod without going through the shell? mongod --shutdown --dbpath "<path>" throws an error that there is no server running at that path when in fact there is a mongodb server running using that path.

Thank you.

Regards,
Raghava.

Asya Kamsky

unread,
Jan 2, 2015, 6:30:10 PM1/2/15
to mongodb-user
I would double check the log directory - I'm guessing you don't have
permissions to either create new file there or move existing file to a
differently named file.

As far as killing - if this is the only mongod running on server you
can always use 'killall -w mongod' or 'kill $(pidof mongod)'

Asya
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user"
> group.
>
> For other MongoDB technical support options, see:
> http://www.mongodb.org/about/support/.
> ---
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mongodb-user...@googlegroups.com.
> To post to this group, send email to mongod...@googlegroups.com.
> Visit this group at http://groups.google.com/group/mongodb-user.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mongodb-user/CAHCfvsS45Q3-A5ESnauYB4sk6RubrCd_AhV2AAkykfsYjA7qaw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Raghava Mutharaju

unread,
Jan 2, 2015, 9:57:19 PM1/2/15
to mongod...@googlegroups.com
Thank you for the response. I think log directory has the required permissions, drwxrwxr-x and it has mongod:mongod as the username and group. What else could be missing?

Regards,
Raghava.

Raghava Mutharaju

unread,
Jan 3, 2015, 4:03:58 PM1/3/15
to mongod...@googlegroups.com
Fixed this. I changed the username:group of the contents of the dbpath and journal to ec2-user:ec2-user. With these changes, it worked when I started mongod as a non-root user.

Regards,
Raghava. 
Reply all
Reply to author
Forward
0 new messages