I have followed the instructions for installing MongoDB through apt-get, from this page: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
This creates a config file called: /etc/mongodb.conf
And a control script called: /etc/init.d/mongodb
These allow me to start mongodb by calling:
sudo service mongodb start
My question is, how do I change the user the mongod process is running under? I've searched the config file, and the control script and neither have any mention of a user. I had to use ps aux | less
to see all the processes and find the mongod process to see what user the process was running under. The call to start doesn't accept a user, and the config file doesn't specify a user, and the control script doesn't either. Does anyone have any idea how to change the user or even how the user to run the process under is being determined?
Step 2: Installing MongoDB Database on Ubuntu During the MongoDB installation, it will create the configuration file /etc/mongod. conf , data directory /var/lib/mongodb and the log directory /var/log/mongodb . By default, MongoDB runs using the mongodb user account.
MongoDB can be installed on Ubuntu with the use of the following commands. These commands are easy to run on the terminal and make the installation process handy. Follow the steps given below to install MongoDB: Step 1: First you need to update and upgrade your system repository in order to install MongoDB.
MongoDB adds a user and group, mongodb
, that runs the process and owns the associated 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 is where you can change the user running mongod.
You will need to add a user and group, for your new daemon user, as well as chown'ing the files to your new user and group. I wouldn't recommend changing the user, however.
Is there a particular reason that you want to change this user to be something you defined yourself?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With