How to reset Unifi Controller from CLI on Debian / Ubuntu.

If you forget password to access unifi controller here you can find way to reset.

First thing generate a new hash password.

root@Debian-unifi:~# mkpasswd -m sha-512
Password:
$6$VnviByhb$y1RgT6vvxNpAAKOB9nnizR6zdAeGYTArQBiIyeSiPuaki49Lnfkh.DqdcPXISVacESE82aH96RqZtt85CfT8c1

Next step you have to log in MongoDB database and change it:

root@Debian-unifi:~# mongo –port 27117
MongoDB shell version: 2.4.10
connecting to: 127.0.0.1:27117/test
Welcome to the MongoDB shell.
For interactive help, type “help”.
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
Server has startup warnings:
Mon May 8 16:26:44.340 [initandlisten]
Mon May 8 16:26:44.340 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Mon May 8 16:26:44.340 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with –journal).
Mon May 8 16:26:44.340 [initandlisten] ** Note that journaling defaults to off for 32 bit and is currently off.
Mon May 8 16:26:44.341 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
Mon May 8 16:26:44.341 [initandlisten]
> use ace
switched to db ace
> db.admin.update( { name: “admin” }, {$set: { x_shadow: “$6$VnviByhb$y1RgT6vvxNpAAKOB9nnizR6zdAeGYTArQBiIyeSiPuaki49Lnfkh.DqdcPXISVacESE82aH96RqZtt85CfT8c1” } } )
> exit
bye

And now you are ready to login with new password. Enjoy !

Leave a Reply

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

4 + 7 =


This site uses Akismet to reduce spam. Learn how your comment data is processed.