I am going to install mongodb on Amazon ec2 ubuntu 12.0.4 linux server and change the default location of the mongodb. I searched the internet and saw a lot of article that tell the user to use. For example this article, page 7.

sudo chown mongod:mongod /your_data_storage_folder

to get permission to your new mongodb location.

I just wonder, there is know mongodb user and mongodb group how could I do that?!! most of the article wrote that and it couldnt work!! Is there any way to do that?! tips?!

1 Answer 1


Did you install MongoDB from Ubuntu repository? If yes then mongodb user will be already there. You can check it by running this command

cat /etc/passwd | grep mongodb

I guess permission problem will be solved by running these command

sudo chown -R mongodb:mongodb /yourmongodb
sudo service mongodb restart

Now MongoDB data files will be stored in /yourmongodb

  • yes, I installed mongodb from 10gen repository, after I installed that as you said, I can easily chown the new location. but the question is why most of the article wrote that chown command before installing mongodb?!
    – user19049
    Jul 31, 2013 at 18:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .