Ubiquiti has finally updated their UniFi Network Server / Controller software to play nicely with Apple Silicon. Previously, some annoying workarounds were necessary to get it running.
With this news, I set about to get into the software, only to find that my supposed password was incorrect. Since the server is running on my machine, there ought to be an easy way to reset the password locally, yet the only officially supported method seems to be to set up an email SMTP server for sending a password reset email - useless if you didn’t already set this up before forgetting the password.
However, there is another way. The password is stored in a MongoDB database which is accessible without authentication on the local machine. We can we can simply generate a new password, salt+hash it, and write that value to the database, setting a new password. These are the steps I followed:
-
Install MongoDB Compass
-
Open a connection to localhost:27117
-
Select the
ace
database, then theadmin
document -
Open command line (should work on macOS, Linux, BSD, etc, as long as
openssl
is installed), and runopenssl passwd -6 -salt 9Ter1EZ9$lSt6
-
Type in the new password, then press
ENTER
-
Write the output of the
openssl
command into thex_shadow
value in the MongoDB database. It should start with$6$
. -
Click
UPDATE
to write the new value. -
Note the username under the
name
field of theace.admin
document in the MongoDB database. -
Log in to the Unifi controller with the username and new password you just set!
Note: My solution is based off of this forum post, but I opted to perform the password hashing locally and to use software from the MongoDB developers to connect to the database.