prabodhtiwari
prabodhtiwari

Reputation: 228

Unable to find mongod.conf file in ubuntu

I want to change auth=false to auth=true in mongod.conf file in ubuntu but not able to find mongod.conf file in /etc/. So which are the other possible locations for finding this file.

Upvotes: 14

Views: 37936

Answers (4)

ezekiel87
ezekiel87

Reputation: 61

Still got this in 2020. reinstalling all mongodb-related packages solved it for me

apt purge mongo*
apt install mongodb

Note that simply reinstalling just mongodb package doesn't fix it.

Upvotes: 5

mjkrause
mjkrause

Reputation: 424

In a terminal run sudo find / -name mongodb.conf (I'm aware that the OP looks for mongod.conf, not sure if this is a typo? No such file on my system...)

Upvotes: 0

Chris
Chris

Reputation: 18876

In my case Ubuntu 18.04: /etc/mongodb.conf

Upvotes: 8

hisener
hisener

Reputation: 1491

Finding your mongod config path using mongo shell:

db.adminCommand('getCmdLineOpts');

It returns all command line options. Just for config path:

db.adminCommand('getCmdLineOpts').parsed.config;

Reference: https://docs.mongodb.org/manual/reference/command/getCmdLineOpts/

--

You can create manually. Path: /etc/mongod.conf

Also take a look https://docs.mongodb.org/v3.0/reference/configuration-options/#use-the-configuration-file

Upvotes: 15

Related Questions