MongoDB Certificate Key File Ownership And Permission
When you setup TLS/SSL for MongoDB Configure mongod and mongos for TLS/SSL , you might encounter the following errors:
| |
or
| |
So what’s the right ownership and permission for the certificate pem file? The answer is: the pem file should have read access but no write access for the user mongodb.
Solution 1
chown mongodb:mongodb [xxx.pem]chmod 400 [xxx.pem]
Finally, the pem files look like this:
Then everything works fine.
If the pem file cannot be read by user mongodb (e.g. file owner is root with 600 permission), then Permission denied.
If the pem file belongs to mongodb but with more permission, then permissions on / are too open.
Solution 2
chmod 644 [xxx.pem]
Unfortunately, the official documentation doesn’t provide tips for this, hope these explanation helps.