Duplicate key in /etc/mongod.conf

mongod.conf has a duplicate key. I could not comment out the duplicate entry because it is read only. the security key is duplicated.

vagrant@m103:~$ mongod -f /etc/mongod.conf
Error parsing YAML config: duplicate key: security.authorization(canonical key: security.authorization)
I cannot do the exercise as written in the lecture “Basic Security 2”. How should I proceed?

Thanks

the file:

vagrant@m103:~$ cat /etc/mongod.conf

mongod.conf

for documentation of all options, see:

http://docs.mongodb.org/manual/reference/configuration-options/

Where and how to store data.

storage:
dbPath: /var/lib/mongodb
journal:
enabled: true

engine:

mmapv1:

wiredTiger:

where to write logging data.

systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log

network interfaces

net:
port: 27017
bindIp: 127.0.0.1

how the process runs

processManagement:
timeZoneInfo: /usr/share/zoneinfo

#security:

#operationProfiling:

#replication:

#sharding:

Enterprise-Only Options:

#auditLog:

#snmp:

security:
authorization: enabled

security:
authorization: enabled

This file is owned by root.So you need sudo privs to edit it
I suggest you make your own config file instead of using this master file which has many parameters which you do not need
cat file
copy and paste into your own file say test.conf under your shared dir and save it
edit as many times as you want

Note:You can make a copy at /etc also but again need to use sudo

1 Like

Hi @Howard_84497,

As @Ramachandra_37567 mentioned, please create your own configuration file so that you get familiar with the YAML syntax. In addition to this, store you configuration file in the /shared folder.

You were getting error because of this. You have two entries for the same field in your configuration file.

Hope it helps! Please feel free to get back to us if you have any other query.

Thanks,
Shubham Ranjan
Curriculum Services Engineer

I know that.

I could not edit the file because it is read only

Howard

Right, I did that.

Thanks