How to reset UniFi controller admin password, without email, including 32bit

I was recently in a situation where I needed to reset a forgotten Ubiquiti UniFi controller password.

There is some forum posts on the Ubiquiti forums, but the procedure is not supported or officially documented in any way, the posts on the forums are also missing some required details I found. The two methods below are adapted from forum posts by Taotech and Apak on the Ubiquiti forums.

The easy method:

If your controller is installed on a 64bit operating system (default for recent versions), you should have no trouble following this method.

  • Download Robo 3T from this link
  • Install and create a profile for your local server, and port number 27117
  • Connect to it, and in the left pane expand “ace” and then “collections”
  • Right-click on “admin” and click “View documents”
  • Open up this link to QuickHash.com
  • In the “Input data” field, type the new password you would like to set, and in the “Salt” field type 9Ter1EZ9$lSt6 and click Generate and your new password hash will be shown in the output field.
  • Copy the output value from QuickHash, and head back to Robo 3T to paste it in the “x_shadow” field.
  • Head back to your UniFi login screen, unter your username and your new password and you should be straight in!

Method for an older server with a 32 bit OS and probably a very old version of UniFi Controller:

The difficulty here is most MongoDB tools are 64-bit only, so this took me a while to figure out.

  • Download mongodb-win32-i386-2.4.14.zip and unzip it somewhere like the desktop
  • Open command prompt and cd to the extracted files
  • Type “mongo.exe –port 27117” and hit enter, you should then be at a mongo prompt.
  • Type “use ace
  • Type “db.admin.find()” to show the current admin record, make a note of the _id field value
  • Open up this link to QuickHash.com
  • In the “Input data” field, type the new password you would like to set, and in the “Salt” field type 9Ter1EZ9$lSt6 and click Generate, and your new password hash will be shown in the output field.
  • Copy the output value from QuickHash.
  • Take the following command and paste it into Notepad or a text editor (pasting to the command prompt and substituting values can be tricky, I prefer to edit the line in Notepad first). Then substitute your _id noted from the earlier step, and your output password hash from QuickHash into the command below.
    db.admin.update({_id:ObjectId("585d16243d093c03b21a800a")}, {$set: {"x_shadow":"$6$9Ter1EZ9$lSt6/tkoPguHqsDK0mXmUsZ1WE2qCM4m9AQ.x9/eVNJxws.hAxt2Pe8oA9TFB7LPBgzaHBcAfKFoLpRQlpBiX1"}})
  • Make sure it is shown on one line, then copy/paste it into your command window and press enter.
  • That should have updated the password, you can confirm if it was successful by running db.admin.find() and comparing the x_shadow value to the new one you have just put in.
  • Head back to the UniFi login page and login with your new password!

Leave a Comment

Your email address will not be published. Required fields are marked *

5 × four =