0

So when ,trying to start monogdb service by command systemctl start mongod, it is giving error as Permission denied to read conf file.

Given same permission as default location conf file to custome location conf file and also update the file /usr/lib/systemd/system/mongod.service and changed the

Environment="OPTIONS=-f /etc/mongod.conf"

to

Environment="OPTIONS=-f /root/mongod.conf"

Can someone please help me with this?

David
  • 2,987
  • 1
  • 29
  • 35
  • try sudo in front of it `sudo systemctl start mongod` – Vihar Manchala Mar 13 '19 at 17:23
  • tried no luck with sudo also @ViharManchala – AKSHAY MORE Mar 13 '19 at 17:42
  • What were the permissions of file /etc/mongod.conf. Can you do `ll /etc/mongod.conf` and show me what it is? – Vihar Manchala Mar 13 '19 at 17:45
  • [root@ip-172-31-32-91 ec2-user]# ll /etc/mongod.conf -rw-r--r--. 1 mongod mongod 801 Mar 13 07:19 /etc/mongod.conf [root@ip-172-31-32-91 ec2-user]# ll /root/mongod.conf -rw-r--r--. 1 mongod mongod 801 Mar 12 09:51 /root/mongod.conf – AKSHAY MORE Mar 14 '19 at 06:07
  • Can you modify the permissions and give it an execute permissions. It just has read access, you may have to add execute permissions. Lemme know if it works – Vihar Manchala Mar 14 '19 at 13:33
  • Also, you can try by changing the owner of the file to root, and then use the command that I have given you before `sudo systemctl start mongod` – Vihar Manchala Mar 14 '19 at 13:38
  • ll /root/mongod.conf -rwxr-xr-x. 1 root root 801 Mar 12 09:51 /root/mongod.conf – AKSHAY MORE Mar 15 '19 at 06:32
  • sudo systemctl start mongod Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details. – AKSHAY MORE Mar 15 '19 at 06:33
  • systemctl status mongod.service ● mongod.service - High-performance, schema-free document-oriented database Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2019-03-15 06:25:11 UTC; 21s ago Docs: https://docs.mongodb.org/manual Process: 4693 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=2). Mar 15 06:25:11 ip-172-31-32-91.us-west-2.compute.internal mongod[4693]: Error reading config file: Permission denied – AKSHAY MORE Mar 15 '19 at 06:35
  • seems to be issue is with systemd when i try to run /usr/bin/mongod -f /root/mongod.conf service started successfully, but systemctl should work as it is standard way of doing it , am i missing something from systemd point of view ? – AKSHAY MORE Mar 15 '19 at 07:26
  • Need help on this – AKSHAY MORE Apr 05 '19 at 06:27
  • Are you still looking for a solution? I found answers on link `https://stackoverflow.com/questions/7948789/mongod-complains-that-there-is-no-data-db-folder?rq=1` – Vihar Manchala Apr 15 '19 at 14:58
  • not found any answers on above link @ViharManchala – AKSHAY MORE Apr 18 '19 at 07:07
  • @ViharManchala it is easily reproducible ,i have give all the possible tries [root@ip-172-31-34-163 ec2-user]# ls -lrt /root/mongod.conf -rwxr-xr-x. 1 mongod mongod 806 Apr 17 06:07 /root/mongod.conf this permission given ti config file – AKSHAY MORE Apr 18 '19 at 07:19

0 Answers0