UniFi - How to recover lost password and username

Overview


We will discuss how to use MongoDB to retrieve your username and password if you are unable to login, your controller is being managed by someone who did not originally install the system, or you have lost or forgotten your login credentials for the UniFi Controller. This method will not reset your network.

Note: These steps must be completed on the same computer that the UniFi Controller is installed to. If you no longer have access to that computer, and you do not have a backup of your UniFi Controller, you'll need to install the UniFi Controller to a new machine, reset and readopt your UAPs, and reconfigure your network. 

Steps


Use MongoDB to retrieve username / password.

    1. Open the UniFi controller program, or make sure the service is running. 
    2. If on Linux, skip to step 4. If on Mac or Windows, please download the mongoDB zip or tgz file by going to THIS site. Once at the site it should automatically detect the proper operating system. Make sure Previous Releases is selected choose a version from 2.2 from the drop down menu on the left.
    3. Extract the contents of the container to your desired location.
    4. Open Terminal (Mac/Linux) or Command Prompt (Windows) and change directory to the /bin folder found within the extracted folder. Do note that Linux users can run the command from any folder, only Mac and Windows users need to change to the /bin folder.
    5. Linux and Windows users type:
       
      mongo --port 27117

      Mac users type: 

      ./mongo --port 27117
    6. Type: 

       use ace
    7. Type:

       db.admin.find()

      The username and password will appear, see the following as an example.

    8. Type: 

       exit
    9. Close the Terminal or Command Prompt session and login to your controller with the recovered username and password.