Migration support included in the MSP plan.

How to recover UniFi controller without credentials

Published onApril 29, 2024

Losing access to your UniFi Controller is annoying. (We have all been here before right?) Whether it's because of forgotten passwords or a change in IT personnel, you need to regain control over your network rather quickly.

This blog post will guide you through the steps to recover your UniFi Controller without credentials. I'm here to help you get in!

Table of Contents

Step-by-Step Recovery Process

Step 1: Verify the Controller's Accessibility

Before proceeding with recovery, make sure that the server or device hosting your UniFi Controller is online. Check the network connectivity and confirm that the UniFi service is running. You can do this by accessing the host machine via SSH or direct console and checking the service status.

Step 2: Attempt to Recover Credentials

First, attempt to recover the admin credentials through the built-in password recovery feature if it was set up initially.

  • Go to the UniFi Controller login page.
  • Click on “Forgot Password?”
  • Follow the prompts to submit your email address. If the email setup was completed during the initial controller setup, you should receive instructions to reset your password.

If you do not have access to the setup email or if email recovery was not configured, proceed to the next steps.

Step 3: Access the System Hosting the Controller

If password recovery via email is not an option, you will need to access the system files directly. This requires access to the host system:

  • For Linux/Unix systems, SSH into the server.
  • For Windows systems, log in via Remote Desktop or directly via the console.

Step 4: Reset the Admin Password via MongoDB

The UniFi Controller uses MongoDB for storing its configuration and user data. You can manually reset the password by accessing the MongoDB database.

Access MongoDB Shell

mongo --port 27117

Switch to the UniFi database

use ace

Update the Admin Password

  { "name" : "admin" },
  { $set : { "x_shadow" : "$6$16CHARACTERSSALT$DIGEST" } }

Replace 16CHARACTERSSALT and DIGEST with the output from a SHA-512 hash generator, which you can create using online tools or command line utilities.

Step 5: Restart the UniFi Controller

After resetting the password, restart the UniFi Controller to apply changes:

service UniFi restart

Step 6: Log Back into the Controller

Try to log into the UniFi Controller using the new credentials. Ensure that you can access all functionalities and that the system is operating normally.

Best Practices for Future Access Management

To avoid similar issues in the future, consider the following best practices:

  • Regular Backups: Regularly back up your UniFi Controller settings and database. In case of recovery, you can restore to a recent backup without losing significant configuration data.
  • Document Credentials: Keep a secure record of administrative credentials and update this documentation any time changes are made.
  • Use a Password Manager: Utilize a password manager for storing and managing complex passwords securely.
  • Enable Email Recovery: Ensure the email recovery method is configured and tested so you can reset passwords through the controller’s user interface.

Final Thoughts

By following the steps outlined above, you can regain control of your UniFi network. It can be technically demanding so make sure you have help nearby if it doesn't work.

To further your network reliability, consider using managed hosting services like UniHosted. We provide security measures and dedicated support to keep your network running smoothly. (We'd help you out when you loose your credentials). Especially, if you are an MSP or IT-service business looking for reliable and secure network deployments, this is something for you.

Feel free to give us a spin! Additionally, I'm happy to walk you through personally. You can schedule a call with me (Founder of UniHosted) here.

We host UniFi Controllers in the Cloud

Are you ready to take your UniFi Network to the next level? Deploy a UniFi Cloud Controller in minutes and manage your network from anywhere.

Deploy Now

Free tier available

Get the best support

Join 1276+ customers

No credit card required