Recover Couchbase password without knowing it

前端 未结 4 989
说谎
说谎 2021-01-15 10:50

I\'m working on a mac, downloaded the community edition for mac. Launched the app, and opened the admin console. So far so good, untill I logged out. Now I

相关标签:
4条回答
  • 2021-01-15 10:57

    On mac you can do the follwing steps

    sudo ln -s $CB_HOME/Couchbase\ Server.app/Contents/Resources/couchbase-core/lib/ /lib
    cd "$CB_HOME/Couchbase Server.app/Contents/Resources/couchbase-core/bin"
    ./erl -noinput -eval 'case file:read_file("[PATH TO DATA]/Library/Application Support/Couchbase/var/lib/couchbase/config/config.dat") of {ok, B} -> io:format("~p~n", [binary_to_term(B)]) end.' -run init stop | grep creds
    

    CB_HOME is pointing to your Couchbase installation directory

    0 讨论(0)
  • 2021-01-15 11:00

    There is a cbreset_password script you can run, located in the /Contents/Resources/couchbase-core/bin folder of you CouchBase server App

    So for me it was in /Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin

    Simply run it and you will be able to reset the password for the Administrator account

    0 讨论(0)
  • 2021-01-15 11:06

    In case it wasn't clear since it was not fully explained in the previous answer and I'm not allowed to comment just yet. The cbreset_password script is a Python script.

    For Mac OS, make sure you have Python installed. Also, there are 2 required pieces of information, the IP address of the Couchbase instance you're trying to reset and the port number. So for a local installation, with a standard Couchbase port of 8091, the command would look something like this:

    python /Applications/Couchbase\ Server.app/Contents/Resources/couchbase-core/bin/cbreset_password 127.0.0.1:8091
    
    0 讨论(0)
  • 2021-01-15 11:17

    Password is saved in plain text in config.dat binary file that located in \var\lib\couchbase folder.

    You can search for string "username" and then next to it you will see "password" field and plain text value of the password.

    I think there is an open defect to have better password storage mechanism in place.

    The password can be changed using the couchbase-cli tool.

    shell> ./couchbase-cli cluster-init -c 127.0.0.1:8091 --user=[CURRENT_USERNAME] --password=[CURRENT_PASSWORD] --cluster-init-username=[NEW_USERNAME] --cluster-init-password=[NEW_PASSWORD]

    0 讨论(0)
提交回复
热议问题