Permission issue

755 views
Skip to first unread message

Gayathri Subash

unread,
Apr 29, 2016, 7:58:48 AM4/29/16
to mongodb-user

When i run the below 2 command i'm getting the following errors


1) Gayathri-MacBook-Pro:~ Gayathri$ mongodb/bin/mongo


2016-04-29T15:17:42.988+0530 I STORAGE  [main] In File::open(), ::open for '/Users/Gayathri/.mongorc.js' failed with errno:13 Permission denied

The ".mongorc.js" file located in your home folder could not be executed


2) Gayathri-MacBook-Pro:~ Gayathri$ mongodb/bin/mongod


2016-04-29T15:23:35.125+0530 I -        [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.

2016-04-29T15:23:35.125+0530 I STORAGE  [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating

2016-04-29T15:23:35.125+0530 I CONTROL  [initandlisten] dbexit:  rc: 100



But if run using SUDO command its working 

sudo mongodb/bin/mongo
sudo mongodb/bin/mongod

and i just a warning below like

2016-04-29T15:11:19.330+0530 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.


Now i wanted to know whether giving sudo command and started the mongo server and client is right ????. If its wrong then what are the steps to correct the permission issue. Kindly let me know the steps in detail.






Rhys Campbell

unread,
Apr 29, 2016, 9:47:36 AM4/29/16
to mongodb-user
Looks like you've installed as root and not changed ownership of the files to the appropriate users.

The file...

/Users/Gayathri/.mongorc.js

Should probably be owned by your login. Check this with ls -lh.

Change with

chown Gayathri:<your group>/Users/Gayathri/.mongorc.js


The the /data/db/* files are normally owned by the mongod user. Again check with ls -lh

If this user exists on your system you'd do...

chown -R monogod:mongod /data/db

See here for detail instructions on installing on OS X




down 

Reply all
Reply to author
Forward
0 new messages