On more than one occasion I have gotten locked out of my UniFi networking administration software. Usually, I could fix this by just installing the latest version and that would clear up whatever mess was being caused. Well, that wasn’t enough this time and I got into a real bind. I started searching around for a solution, found one that in theory would work, but it was so old that it wouldn’t work easily anymore. Well I did the hard work and I just want to share it with everyone to save them the hours of work I just went through.
Before we start
Let’s review a few things before getting into this.
- At the time of writing this 2026-02-01 the name of the software is
UniFi Network Application. This software has changed its name like three or four times which is very unhelpful. It used to be calledUniFi Serverand before that it was calledUniFi Controller.- I will be referring to this as “the server” or “server” moving forward.
- This article is assuming you are using Windows.
- There isn’t proper Linux support for this software even though they offer a Debian version, I have heard it’s not great.
- Always make a full backup of your UniFi installation. Just archive the whole
Ubiquiti UniFifolder while the software is not running.- Example: C:\Users\<username>\Ubiquiti UniFi
- Getting the latest software depends on your device. In my case I am using three UAP-AC-PRO WAPs in my house. They have been absolutely the best WAPs I have ever had. Here is the link to the software which will realistically go dead at one point: https://ui.com/download/software/uap-ac-pro
- I strongly recommend that you ALWAYS export as many of the configuration files as offered. It has varied over the years. As of my last backup it has been two files ending extensions
*.unfand*.supp. - I strongly recommend that you copy down (setup if you didn’t) the SSH information of each WAP because if you lose the server for any reason, you can readopt each WAP more easily by being able to configure each WAP directly. The alternative is wiping each WAP and starting over the choice is yours.
Head slapping gotcha
Make absolutely sure that the copy of the software you are connecting to is for the dedicated physical location. This is what screwed me up here and I ended up learning how to do all of this when I didn’t need to. Still a good exercise. I was trying to use the credentials for the wrong copy of the server because it was for a different residence that I setup. I forgot I did this, so that’s my fault. My loss is everyone’s gain though heh.
Resetting the password forcefully
It is assumed that by this point you have already tried:
- Every password you have and none of them work.
- You attempted to reset the password via email, but it says something like, “The email address you have supplied is not registered with this device.” or some such nonsense.
- Last try – check the case of your email address. I have a feeling it’s case sensitive. I can’t confirm this because I didn’t get to test it, but while investigating the data I did see that my email address was in two different cases between server copies (physical locations). So this could be why I got this error too.
Just a reminder I am providing this solution as-is. You need to be careful with software you find on the internet. I am not responsible for any damage that could be caused; however unlikely.
Now that you have tried everything choose your adventure:
- I just want the answer and I don’t care about how you did it – CLICK HERE.
- I want to know how you did this – keep reading below:
Theory
All of the solutions I found online were people using MongoDB Compass or Studio 3T in order to edit the MongoDB directly. This came as a surprise to me because I didn’t realize that Ubiquiti was using MongoDB. Much to my horror when I tried to use the solution as is I was met with this fun error:

The left panel reads:
Unsupported MongoDB version: You are trying to connect to a version of MongoDB that’s no longer officially supported. Only versions 4.0 and up are supported.
Details:
Server at localhost:27117 reports wire version 6, but this version of the driver requires at least 7 (MongoDB 3.6).
So all this means is that the solution has aged out because the navigation tools cannot support such an old version of MongoDB.
WTF Mongo
I have complained plenty about my distaste for Mongo and well this doesn’t help. So after doing some research it seems that Ubiquiti is keenly aware that they are using an outdated version of MongoDB, but they have coded themselves into a corner because upgrading to the latest version of Mongo is not insignificant. Therefore, anyone using their software is pretty hosed until there is a proper replacement with migration option. Mongo has done this before where a path for upgrade is completely unavailable because they have rearchitected entire methodologies of their software. Mongo is not enterprise friendly in my opinion and I don’t trust their fickle and unstable nature.
UniFi MongoDB versions
wire version 6apparently is another name forMongoDB 3.6.x- When you look this up you find all kinds of unhelpful information telling you to upgrade your server. Thanks Mongo.
- The idea is that if you cannot use the navigation tools anymore, then you have to do it yourself, which means scripting something up. In order to do that you need to find the appropriate driver, which is risky if you don’t use the CORRECT driver. You need to use the driver for the language that is accessing it which in Ubiquiti’s case it is Java, because of course it is.
- The required driver is version
2.27.0– it took too much to get a straight answer on this. Thanks Mongo.
Execution
Anyway, so I won’t use Java because ewww no and I wasn’t about to search for an older copy of Mongo’s stupid shell either. Instead I went back to old reliable, C#, because I knew I would only be editing strings. I can’t login anyway right? So who cares what happens, especially if I still have backups.
- Being Lazy I am using LinqPad for this because I can.
- You require the the NuGet package
MongoDB.Driver version 2.27.0. - Namespaces are
MongoDB.DriverandMongoDB.Bson - Here is my full script: https://github.com/dyslexicanaboko/code-snippets/blob/develop/LinqPadScripts/Tools/UniFi-mongodb-explorer.linq
- I can’t promise that this will stay in the same location, so I will explain the more important parts below.
UniFi database schema
Where is the data located?
- Server: localhost:27117
- This is the default MongoDB connection. If you changed yours, then you have to change the script!
- Database: ace
- Collection: admin
- There is a single document in here.
- Property: x_shadow
- This is the encrypted password
- Other properties of interest
- email – is your email
- name – is your username
Make sure to START the server before running the below. That’s the only way for the MongoDB to be accessible.
Great, now that we know where it is, we can just connect ourselves and change it. Here is the snippet for that, but again the whole script is linked above on GitHub.
MongoClient _client = new MongoClient("mongodb://localhost:27117");
void Main()
{
UpdateProperty("ace", "admin", "x_shadow", "$6$OzJJ0heL$XyD5qt4pviLieuj8CMFbnSc9VYvxDyzYpH7dHC8wmaLwKv9xwyDxBiMx3GcT8nEdIa7XJbqlZo39jhfbQBXRM/");
}
public void UpdateProperty(
string databaseName,
string collectionName,
string property,
string value)
{
var db = _client.GetDatabase(databaseName);
var collection = db.GetCollection<BsonDocument>(collectionName);
var filter = FilterDefinition<BsonDocument>.Empty;
var update = Builders<BsonDocument>.Update.Set(property, value);
var result = collection.UpdateOne(filter, update);
Console.WriteLine($"Matched: {result.MatchedCount}, Modified: {result.ModifiedCount}");
}
I wrote it out atomically and very clearly so I wouldn’t make any mistakes. My full script will print out the password you have now, update it, then print again to show that it was updated. The most important take away here is that you are changing your password from whatever it was to an unsafe known password.
The password you changed it to is password123
Make sure after you do this, you update your password, and save it somewhere safe this time if you forgot what it was.
Other stuff
This is where all of the important stuff lives for the server:
- C:\Users\dysle\Ubiquiti UniFi\bin
- C:\Users\dysle\Ubiquiti UniFi\data\db
If you want to see the MongoDB version for yourself, run the software, then run this command in PowerShell:
CD "C:\Users\dysle\Ubiquiti UniFi\bin"
.\mongod.exe --version
In the script I have more methods for exploring the database. I was curious about a few things, so I just kept writing methods until I found everything I wanted to know.
Can you make this into an executable for me?
No – I don’t have time to deal with individual user problems, so I am not going to do that sorry. Grab the code and do what you want with it. I did this once for the WCF Client and regretted it because as time moved on it stopped working and people were hounding me to fix it. I learned my lesson.
Why didn’t you do X?
Because I didn’t.
I have questions though
Submit a comment below and I will try to get to it as soon as I can. Sorry, I just hardly have time to even write articles anymore, so it’s hard for me to go further than providing the beginning solution.
