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
/root
directory where the keyfile currrently lives? Themongod
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 theroot
user.