MongoDB File Permissions

84 views
Skip to first unread message

Mike Andrews

unread,
Aug 22, 2017, 7:36:58 AM8/22/17
to mongodb-user
Is it possible to change the default file permissions MongoDB gives the datafiles?
I'm using version 3.4.4 and want the file permissions to be 660 by default rather than 644, is this possible?
(I do not want to have to change file permissions after the files have been created)

Andrew Morrow

unread,
Aug 23, 2017, 1:01:07 PM8/23/17
to mongod...@googlegroups.com

Hi -

In all current stable versions of MongoDB, the server writes files in accordance with your umask, though some files are opened O_CREAT with more restrictive permissions set. More recently, on the master branch, that has changed per SERVER-22829. As of the resolution of that ticket, server processes update the umask to remove group and other permissions by default, unless overridden by passing --setParameter=honorSystemUmask=true at startup.

For the stable releases, if you would like to tighten the permissions given to created files, it should be sufficient to simply update your umask in your shell before starting mongod or mongos. Alternatively, if you are using an init script or similar, you can probably update that to similarly set a more restrictive umask.

Thanks,
Andrew


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/37ca1224-fe38-4bba-a73f-fcd88fa02488%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages