I configured in /etc/mongod.conf to enforce keyfile access control, in security option enabled, keyFile is /root/dbtest.key (the absolute path of keyfile). I already gave the ownership to mongodb user by chown, and granted 400 permission on that dbtest.key file.

But mongod keeps failing to start, after checking log, the error is Error reading file /root/dbtest.key: Permission denied. After checking the ownership and permissions on dbtest.key

Which means I already granted correctly. So I don't know at which step I did wrong

  • What O/S are you using and how are you starting the MongoDB server? What are the permissions for the /root directory where the keyfile currrently lives? The mongod process will need to to have read permission for the directory as well as the keyfile. I suspect you should use a path other than /root, since this is normally the root user's home directory with access restricted to the root user. – Stennie Aug 3 '19 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.