0

When using the command

db["my_collectionName"].find() 

in the mongo shell, my queries return:

"message" : "Permission denied @ rb_sysopen - /var/log/syslog".

How do I go about solving this permission issue?

m00am
  • 5,910
  • 11
  • 53
  • 69
AspEng
  • 11
  • 5

2 Answers2

0

Make sure you have proper permissions for /data/db folder/directory.

Andrew Komiagin
  • 6,446
  • 1
  • 13
  • 23
  • thanks for your response. Per your response I tried the command: sudo chmod 0755 /data/db && sudo chown $USER /data/db and my permission is still denied – AspEng Jul 12 '18 at 08:44
  • You have to do it recursively: sudo chown -R mongodb:mongodb /data/db – Andrew Komiagin Jul 12 '18 at 08:47
  • Have you checked the log file /var/log/mongodb/mongodb.log ? – Andrew Komiagin Jul 12 '18 at 08:49
  • Kormiagin I did as you suggested i.e.,sudo chown -R mongodb:mongodb /data/db ...here is a snippet of the log file: – AspEng Jul 12 '18 at 11:16
  • 018-07-12T13:03:24.763+0200 I NETWORK [listener] connection accepted from 127.0.0.1:17481 #8 (2 connections now open) 2018-07-12T13:12:39.358+0200 I NETWORK [listener] connection accepted from 127.0.0.1:17492 #9 (3 connections now open) 2018-07-12T13:12:39.361+0200 I NETWORK [conn9] received client metadata from 127.0.0.1:17492 conn9: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.0" }, os: { type: "Linux", name: "PRETTY_NAME="Debian GNU/Linux 8 (jessie)"", architecture: "x86_64", version: "Kernel 3.16.0-4-amd64" } } – AspEng Jul 12 '18 at 11:17
  • Problem solved using: chmod 775 /var/log/syslog usermod -a -G adm td-agent...Thanks – AspEng Jul 12 '18 at 12:31
0

You can try:

sudo chown -R mongodb:mongodb /data/db

Check all paths in mongodb config (/etc/mongod.conf) and assign right permission (dbpath, logpath...)

Hoang
  • 11
  • 2