Pages
  • Homepage
  • Queztaz/Tech Inventory
  • Emacs/EWW Hacks
  • Emacs/Emacs With BiDirectional Google Calendar Sync
  • Emacs/Setting up Mu4e and Multiple Gmail Accounts
  • Linux/Creating an Offline Debian Mirror Repository
  • Linux/Migrate Wiki.js to Another Server
  • Linux/Adding Bitwarden to the Pinephone Pro
  • Linux/Corebooting Thinkpad X220 With CH341A Programmer
  • Pinebook Pro/Custom Kernel
  • Pinebook Pro/Keyboard Firmware Update
  • Pinebook Pro/Netbsd Installation
  • Pinebook Pro/Setting Up Zram
  • Pinebook Troubleshooting/Pro Common Issues
  • Pinebook Pro/Use NVME as Root
  • Pinebook Pro/Write to SPI Flash
  • Qemu/Chroot Into a Different Architecture
  • Qemu/Choot Into an Img File
  • Qemu/Mount Virtual Images
  • Qemu/Windows Xp Fix Smb Not Working
  • Qemu/Windows Xp Installation
  • Misc/Finding the Default Wireless Password to TG1672G Routers
  • Misc/Running Ollama Portably
  • Misc/Resetting Unifi Controller Password with MongoDB CLI
  • Misc/Turning an Amazon FireStick into a Portable Computer
  • Windows/Cloning a Bios Boot Drive to Disimilar Hardware with UEFI
  • Windows/Automatic CHKDSK Scans Using Powershell & Email Alerts
  • Windows/Creating a Decent Portable Terminal
  • Windows/Merging HyperV Snapshots With Powershell
  • Windows/Simulating Bad Blocks on NTFS Filesystems
  • Windows/Creating and Viewing a Storport on Windows Server
  • Windows/Windows 11 PowerShell Upgrade Script
  • Mikrotik/Creating a Client to Site VPN With
  • Mikrotik/Securing Router With Firewall
  • Mikrotik Setup Dynamically Changing IP With No-IP Api
Homepage
  • Homepage
  • Queztaz/Tech Inventory
  • Emacs/EWW Hacks
  • Emacs/Emacs With BiDirectional Google Calendar Sync
  • Emacs/Setting up Mu4e and Multiple Gmail Accounts
  • Linux/Creating an Offline Debian Mirror Repository
  • Linux/Migrate Wiki.js to Another Server
  • Linux/Adding Bitwarden to the Pinephone Pro
  • Linux/Corebooting Thinkpad X220 With CH341A Programmer
  • Pinebook Pro/Custom Kernel
  • Pinebook Pro/Keyboard Firmware Update
  • Pinebook Pro/Netbsd Installation
  • Pinebook Pro/Setting Up Zram
  • Pinebook Troubleshooting/Pro Common Issues
  • Pinebook Pro/Use NVME as Root
  • Pinebook Pro/Write to SPI Flash
  • Qemu/Chroot Into a Different Architecture
  • Qemu/Choot Into an Img File
  • Qemu/Mount Virtual Images
  • Qemu/Windows Xp Fix Smb Not Working
  • Qemu/Windows Xp Installation
  • Misc/Finding the Default Wireless Password to TG1672G Routers
  • Misc/Running Ollama Portably
  • Misc/Resetting Unifi Controller Password with MongoDB CLI
  • Misc/Turning an Amazon FireStick into a Portable Computer
  • Windows/Cloning a Bios Boot Drive to Disimilar Hardware with UEFI
  • Windows/Automatic CHKDSK Scans Using Powershell & Email Alerts
  • Windows/Creating a Decent Portable Terminal
  • Windows/Merging HyperV Snapshots With Powershell
  • Windows/Simulating Bad Blocks on NTFS Filesystems
  • Windows/Creating and Viewing a Storport on Windows Server
  • Windows/Windows 11 PowerShell Upgrade Script
  • Mikrotik/Creating a Client to Site VPN With
  • Mikrotik/Securing Router With Firewall
  • Mikrotik Setup Dynamically Changing IP With No-IP Api

Misc/Resetting Unifi Controller Password with MongoDB CLI

Table of content
  • Resetting the password

Directions for resetting the admin users password on a Unifi Controller. I did this for a Unifi Network Controller running off of a Windows machine.

Resetting the password

First download the MongoDB CLI tool using either of these two links. I have tested this on older Unifi Controller versions all the way up to version 9.5

  • https://archive.org/download/mongodb-win32-x86_64-3.2.0/mongodb-win32-x86_64-3.2.0.zip

  • https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-3.2.0.zip

Extract the zip file and open it with CMD.exe (not powershell)

Run the following command to print out the admin users username and encrypted password

mongo.exe --port 27117 ace --eval "db.admin.find().forEach(printjson);"

The output should resemble this:

CMD> mongo.exe --port 27117 ace --eval "db.admin.find().forEach(printjson);"
[...]
        },
        "x_shadow" : "$6$9Ter1EZ9$lSt6/tkoPguHqsDK0mXmUsZ1WE2qCM4m9AQ.x9/eVNJxws.hAxt2Pe8oA9TFB7LPBgzaHBcAfKFoLpRQlpBiX1",
        "name" : "admin",
        "time_created" : NumberLong(1764786455),
        "email" : "[email protected]",
        "last_login_timestamp" : NumberLong(1764789489),
        "last_login_ip" : "127.0.0.1"
}
[...]

The Unifi controller password is stored encrypted using the SHA512 Crypt(3) $6$ algorithm. Use the command below to change the password for "admin" to be "password". To set a custom password, use a hash calculator to create a new password using SHA512 Crypt(3) $6$. Modify the command below and replace the existing hash ($6$[...]iX1) with the newly generated hash

Hash Calculator: https://tomi.cc/hash/

mongo.exe --port 27117 ace --eval ^"db.admin.update^( { \^"name\^" : \^"admin\^" }, { $set : { \^"x_shadow\^" : \^"$6$9Ter1EZ9$lSt6/tkoPguHqsDK0mXmUsZ1WE2qCM4m9AQ.x9/eVNJxws.hAxt2Pe8oA9TFB7LPBgzaHBcAfKFoLpRQlpBiX1\^" } } ^)^"
PREVRANDOMNEXT