Change user mongod works in ubuntu

I followed the instructions for installing MongoDB via apt-get from this page: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

This creates a configuration file called: /etc/mongodb.conf

And the script control is called: /etc/init.d/mongodb

This allows me to start mongodb by calling:

sudo service mongodb start 

My question is: how to change the user mongod is working with? I was looking for a configuration file and a script control and none of them mention the user. I had to use ps aux | less ps aux | less to see all the processes and find the mongod process to find out which user the process is working with. The call to run does not accept the user, and the user is not specified in the configuration file, and the script control is not specified either. Does anyone know how to change a user or even how a user starts this process? Is determined?

+4
source share
1 answer

MongoDB adds a user and mongodb group, which starts the process and owns related files, such as logs in / var / log / mongodb and database files in / var / lib / mongodb

If you look in /etc/init.d/mongodb, you will see DAEMONUSER=${DAEMONUSER:-mongodb} - here you can change the user executing mongod.

You will need to add a user and group for your new daemon user, as well as debug files for your new user and group. However, I would not recommend changing the user.

Is there any specific reason why you want to change this user to be what you yourself have defined?

+11
source

All Articles