Mongo: Not authorized to do anything after enabling service on boot












0















I have been using MLab and MongoAtlas successfully for a project I'm working on. Now I'm trying to migrate the DB to local storage so that the software can write and store data without needing internet access.



The problem has come up after the initial install on an rPi3B+ running openSuse Tumbleweed. I installed it, ran mongod, then mongo. Once in the shell I ran a few simple things like show dbs without a problem.



Then I ran these two lines from this tutorial (for ubuntu 18.04): https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu/



sudo systemctl start mongodb
sudo systemctl enable mongodb


Note: the tutorial specifies mongod but that didn't work until using mongodb



After this I run into an authorization problem when using show dbs and db.createUser().



"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, $db: "admin" }",
"code" : 13,
"codeName" : "Unauthorized"


Even when running sudo mongo to enter the shell this is still a problem. What about that tutorial changed my ability to use the shell? Also, what would be the better way to run mongo as a service on boot up?



Thanks!










share|improve this question























  • I was just going over the openSuse Wiki: en.opensuse.org/MongoDB Created a user prior to enabling the service, confirmed login as the wiki shows but then when I enable the service I can't log in with that user. What's happening with running it as a service?

    – Eru
    Jan 6 at 3:12











  • What is MongoDB version(x,y,z)?

    – Md Haidar Ali Khan
    Jan 7 at 10:43











  • what is showing the status of MongoDB through (sudo systemctl status mongod)

    – Md Haidar Ali Khan
    Jan 7 at 10:44











  • what I ended up having to do was run mongo -u admin -p admin123 --authenticationDatabase admin. Still can't figure out what's going on and am having trouble connecting to mongo locally. Went back to using atlas for the time being.

    – Eru
    1 hour ago











  • Check the "Role" of the user and "authenticate" the user.

    – Md Haidar Ali Khan
    14 mins ago
















0















I have been using MLab and MongoAtlas successfully for a project I'm working on. Now I'm trying to migrate the DB to local storage so that the software can write and store data without needing internet access.



The problem has come up after the initial install on an rPi3B+ running openSuse Tumbleweed. I installed it, ran mongod, then mongo. Once in the shell I ran a few simple things like show dbs without a problem.



Then I ran these two lines from this tutorial (for ubuntu 18.04): https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu/



sudo systemctl start mongodb
sudo systemctl enable mongodb


Note: the tutorial specifies mongod but that didn't work until using mongodb



After this I run into an authorization problem when using show dbs and db.createUser().



"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, $db: "admin" }",
"code" : 13,
"codeName" : "Unauthorized"


Even when running sudo mongo to enter the shell this is still a problem. What about that tutorial changed my ability to use the shell? Also, what would be the better way to run mongo as a service on boot up?



Thanks!










share|improve this question























  • I was just going over the openSuse Wiki: en.opensuse.org/MongoDB Created a user prior to enabling the service, confirmed login as the wiki shows but then when I enable the service I can't log in with that user. What's happening with running it as a service?

    – Eru
    Jan 6 at 3:12











  • What is MongoDB version(x,y,z)?

    – Md Haidar Ali Khan
    Jan 7 at 10:43











  • what is showing the status of MongoDB through (sudo systemctl status mongod)

    – Md Haidar Ali Khan
    Jan 7 at 10:44











  • what I ended up having to do was run mongo -u admin -p admin123 --authenticationDatabase admin. Still can't figure out what's going on and am having trouble connecting to mongo locally. Went back to using atlas for the time being.

    – Eru
    1 hour ago











  • Check the "Role" of the user and "authenticate" the user.

    – Md Haidar Ali Khan
    14 mins ago














0












0








0








I have been using MLab and MongoAtlas successfully for a project I'm working on. Now I'm trying to migrate the DB to local storage so that the software can write and store data without needing internet access.



The problem has come up after the initial install on an rPi3B+ running openSuse Tumbleweed. I installed it, ran mongod, then mongo. Once in the shell I ran a few simple things like show dbs without a problem.



Then I ran these two lines from this tutorial (for ubuntu 18.04): https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu/



sudo systemctl start mongodb
sudo systemctl enable mongodb


Note: the tutorial specifies mongod but that didn't work until using mongodb



After this I run into an authorization problem when using show dbs and db.createUser().



"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, $db: "admin" }",
"code" : 13,
"codeName" : "Unauthorized"


Even when running sudo mongo to enter the shell this is still a problem. What about that tutorial changed my ability to use the shell? Also, what would be the better way to run mongo as a service on boot up?



Thanks!










share|improve this question














I have been using MLab and MongoAtlas successfully for a project I'm working on. Now I'm trying to migrate the DB to local storage so that the software can write and store data without needing internet access.



The problem has come up after the initial install on an rPi3B+ running openSuse Tumbleweed. I installed it, ran mongod, then mongo. Once in the shell I ran a few simple things like show dbs without a problem.



Then I ran these two lines from this tutorial (for ubuntu 18.04): https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu/



sudo systemctl start mongodb
sudo systemctl enable mongodb


Note: the tutorial specifies mongod but that didn't work until using mongodb



After this I run into an authorization problem when using show dbs and db.createUser().



"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, $db: "admin" }",
"code" : 13,
"codeName" : "Unauthorized"


Even when running sudo mongo to enter the shell this is still a problem. What about that tutorial changed my ability to use the shell? Also, what would be the better way to run mongo as a service on boot up?



Thanks!







mongodb






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 6 at 2:55









EruEru

1




1













  • I was just going over the openSuse Wiki: en.opensuse.org/MongoDB Created a user prior to enabling the service, confirmed login as the wiki shows but then when I enable the service I can't log in with that user. What's happening with running it as a service?

    – Eru
    Jan 6 at 3:12











  • What is MongoDB version(x,y,z)?

    – Md Haidar Ali Khan
    Jan 7 at 10:43











  • what is showing the status of MongoDB through (sudo systemctl status mongod)

    – Md Haidar Ali Khan
    Jan 7 at 10:44











  • what I ended up having to do was run mongo -u admin -p admin123 --authenticationDatabase admin. Still can't figure out what's going on and am having trouble connecting to mongo locally. Went back to using atlas for the time being.

    – Eru
    1 hour ago











  • Check the "Role" of the user and "authenticate" the user.

    – Md Haidar Ali Khan
    14 mins ago



















  • I was just going over the openSuse Wiki: en.opensuse.org/MongoDB Created a user prior to enabling the service, confirmed login as the wiki shows but then when I enable the service I can't log in with that user. What's happening with running it as a service?

    – Eru
    Jan 6 at 3:12











  • What is MongoDB version(x,y,z)?

    – Md Haidar Ali Khan
    Jan 7 at 10:43











  • what is showing the status of MongoDB through (sudo systemctl status mongod)

    – Md Haidar Ali Khan
    Jan 7 at 10:44











  • what I ended up having to do was run mongo -u admin -p admin123 --authenticationDatabase admin. Still can't figure out what's going on and am having trouble connecting to mongo locally. Went back to using atlas for the time being.

    – Eru
    1 hour ago











  • Check the "Role" of the user and "authenticate" the user.

    – Md Haidar Ali Khan
    14 mins ago

















I was just going over the openSuse Wiki: en.opensuse.org/MongoDB Created a user prior to enabling the service, confirmed login as the wiki shows but then when I enable the service I can't log in with that user. What's happening with running it as a service?

– Eru
Jan 6 at 3:12





I was just going over the openSuse Wiki: en.opensuse.org/MongoDB Created a user prior to enabling the service, confirmed login as the wiki shows but then when I enable the service I can't log in with that user. What's happening with running it as a service?

– Eru
Jan 6 at 3:12













What is MongoDB version(x,y,z)?

– Md Haidar Ali Khan
Jan 7 at 10:43





What is MongoDB version(x,y,z)?

– Md Haidar Ali Khan
Jan 7 at 10:43













what is showing the status of MongoDB through (sudo systemctl status mongod)

– Md Haidar Ali Khan
Jan 7 at 10:44





what is showing the status of MongoDB through (sudo systemctl status mongod)

– Md Haidar Ali Khan
Jan 7 at 10:44













what I ended up having to do was run mongo -u admin -p admin123 --authenticationDatabase admin. Still can't figure out what's going on and am having trouble connecting to mongo locally. Went back to using atlas for the time being.

– Eru
1 hour ago





what I ended up having to do was run mongo -u admin -p admin123 --authenticationDatabase admin. Still can't figure out what's going on and am having trouble connecting to mongo locally. Went back to using atlas for the time being.

– Eru
1 hour ago













Check the "Role" of the user and "authenticate" the user.

– Md Haidar Ali Khan
14 mins ago





Check the "Role" of the user and "authenticate" the user.

– Md Haidar Ali Khan
14 mins ago










1 Answer
1






active

oldest

votes


















0














As I am able to see that you are getting the following error



"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, $db: "admin" }",
"code" : 13,
"codeName" : "Unauthorized"


As per MongoDB documentation here To authenticate as a user, you must provide a username, password, and the authentication database associated with that user.



To authenticate using the mongo shell, either:




  1. Use the mongo
    command-line authentication options (--username,
    --password,
    and --authenticationDatabase)
    when connecting to the mongod
    or mongos
    instance, or

  2. Connect first to the mongod
    or mongos
    instance, and then run the
    authenticate command or the
    db.auth() method against the authentication database.



Note: MongoDB Atlas natively supports authentication via LDAP. Atlas automatically syncs with your LDAP server and makes it easy for
your users to authenticate with their existing credentials




For further your ref here and here






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "182"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f226422%2fmongo-not-authorized-to-do-anything-after-enabling-service-on-boot%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    As I am able to see that you are getting the following error



    "errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, $db: "admin" }",
    "code" : 13,
    "codeName" : "Unauthorized"


    As per MongoDB documentation here To authenticate as a user, you must provide a username, password, and the authentication database associated with that user.



    To authenticate using the mongo shell, either:




    1. Use the mongo
      command-line authentication options (--username,
      --password,
      and --authenticationDatabase)
      when connecting to the mongod
      or mongos
      instance, or

    2. Connect first to the mongod
      or mongos
      instance, and then run the
      authenticate command or the
      db.auth() method against the authentication database.



    Note: MongoDB Atlas natively supports authentication via LDAP. Atlas automatically syncs with your LDAP server and makes it easy for
    your users to authenticate with their existing credentials




    For further your ref here and here






    share|improve this answer




























      0














      As I am able to see that you are getting the following error



      "errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, $db: "admin" }",
      "code" : 13,
      "codeName" : "Unauthorized"


      As per MongoDB documentation here To authenticate as a user, you must provide a username, password, and the authentication database associated with that user.



      To authenticate using the mongo shell, either:




      1. Use the mongo
        command-line authentication options (--username,
        --password,
        and --authenticationDatabase)
        when connecting to the mongod
        or mongos
        instance, or

      2. Connect first to the mongod
        or mongos
        instance, and then run the
        authenticate command or the
        db.auth() method against the authentication database.



      Note: MongoDB Atlas natively supports authentication via LDAP. Atlas automatically syncs with your LDAP server and makes it easy for
      your users to authenticate with their existing credentials




      For further your ref here and here






      share|improve this answer


























        0












        0








        0







        As I am able to see that you are getting the following error



        "errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, $db: "admin" }",
        "code" : 13,
        "codeName" : "Unauthorized"


        As per MongoDB documentation here To authenticate as a user, you must provide a username, password, and the authentication database associated with that user.



        To authenticate using the mongo shell, either:




        1. Use the mongo
          command-line authentication options (--username,
          --password,
          and --authenticationDatabase)
          when connecting to the mongod
          or mongos
          instance, or

        2. Connect first to the mongod
          or mongos
          instance, and then run the
          authenticate command or the
          db.auth() method against the authentication database.



        Note: MongoDB Atlas natively supports authentication via LDAP. Atlas automatically syncs with your LDAP server and makes it easy for
        your users to authenticate with their existing credentials




        For further your ref here and here






        share|improve this answer













        As I am able to see that you are getting the following error



        "errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, $db: "admin" }",
        "code" : 13,
        "codeName" : "Unauthorized"


        As per MongoDB documentation here To authenticate as a user, you must provide a username, password, and the authentication database associated with that user.



        To authenticate using the mongo shell, either:




        1. Use the mongo
          command-line authentication options (--username,
          --password,
          and --authenticationDatabase)
          when connecting to the mongod
          or mongos
          instance, or

        2. Connect first to the mongod
          or mongos
          instance, and then run the
          authenticate command or the
          db.auth() method against the authentication database.



        Note: MongoDB Atlas natively supports authentication via LDAP. Atlas automatically syncs with your LDAP server and makes it easy for
        your users to authenticate with their existing credentials




        For further your ref here and here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 16 mins ago









        Md Haidar Ali KhanMd Haidar Ali Khan

        3,57762340




        3,57762340






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Database Administrators Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f226422%2fmongo-not-authorized-to-do-anything-after-enabling-service-on-boot%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Liste der Baudenkmale in Friedland (Mecklenburg)

            Single-Malt-Whisky

            Czorneboh