Skip to main content

mongoDB in cPanel

Comments

11 comments

  • GOT
    Since you are running CloudLinux does that mean you have also enabled cagefs? I'm not sure what all would be involved but you can either take this user out of cagefs or you can add the mongo command to the cage skeleton.
    0
  • Tarak Nath
    Thank you @GOT for your response. No, I have not enabled cagefs yet. Should I enable so that we can run "mongo" command from cPanel terminal? Thanks, Tarak Nath
    0
  • GOT
    If you don't have cagefs enabled then that would not be interfering. It's more likely in this case that mongo is in a path that the user does not have in their default path. Make sure the users shell is set to bash and not jailshell and then use the full path to the mongo binary when executing it. The user may also not have per.issikns on the command either
    0
  • cPanelMichael
    Hello @Tarak Nath, First, execute the following command as root to find the full path to Mongo: which mongo
    Then, access SSH as the user and enter the full path (e.g. /usr/local/bin/mongo) when executing a mongo command. Let me know if this helps. Thank you.
    0
  • Tarak Nath
    Hello @cPanelMichael , Below is the output as root: root@server1 [~]# which mongo /usr/bin/mongo
    And below is out put as cPanel user: user@server1# /usr/bin/mongo bash: /usr/bin/mongo: No such file or directory
    We are facing same issue. Thanks, Tarak Nath
    0
  • cPanelMichael
    user@server1# /usr/bin/mongo bash: /usr/bin/mongo: No such file or directory

    Hello @Tarak Nath, You mentioned using CloudLinux with CageDS disabled. Are you positive that CageFS is disabled? You can review the CageFS document below to verify if it's installed or uninstalled: Command-line Tools If it's installed, you'll need to perform the steps noted on the following document (replacing "java" with "mongo"): How to add java to CageFS Let me know if this helps. Thank you.
    0
  • Tarak Nath
    Hello, I meant to say that said user is in the CageFS not out of CageFS. For testing purposes I have removed the said user from CageFS and noticed that said user able to run 'mongo' command. Is it best practices to remove the user from CageFS for security reasons? Or add the 'mongo' command to CageFS? What you suggest us? Thanks, Tarak Nath
    0
  • cPanelMichael
    Is it best practices to remove the user from CageFS for security reasons? Or add the 'mongo' command to CageFS?

    Hello @Tarak Nath, Making the "mongo" command available to CageFS is generally the better approach compared to disabling CageFS completely for a user. Thank you.
    0
  • Tarak Nath
    Hi @cPanelMichael , Thank you for your suggestion. As per the document How to add java to CageFS we made the "mongo" command available to CageFS and its perfectly working from cPanel user's terminal which we wanted. Again thank you very much for your suggestion & support. Really its very appreciated. Kindly mark this thread as 'SOLVED'. Regards, Tarak Nath
    0
  • cPanelMichael
    Hello @Tarak Nath, I'm happy to see that helped. I've marked this thread as solved. Thanks!
    0
  • ashwinilute
    We can go with the @Tarak Nath code which is very useful.
    0

Please sign in to leave a comment.