MongoDB Permission

Written by Arvind

MongoDB starting : pid=12450 port=27017 dbpath=/data/db 64-bit host=arvind-MacBook-Pro.local
db version v3.2.5
git version: 34e65e5383f7ea1726332cb175b73077ec4a1b02
OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
allocator: system
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
options: {}
exception in initAndListen std::exception: boost::filesystem::status: Permission denied: "/data/db/storage.bson", terminating
dbexit: rc: 100

Have you experience this error before? If yes! here’s how to fix it. All you need to do is to give permission to /data/ folder in the root directory.

sudo chown -R arvind:staff /data

Now try running mongod again and everythings a ok.