Сброс пароля контроллера UniFi / Хабр
- Tutorial
mongo --port 27117 ace --eval 'db.admin.find().forEach(printjson);'
В данном конкретном случае запрашиваем информацию для учетной записи admin
. Если ищем для учетки VasyaPupkin
запрос будет выглядеть следующим образом:
mongo --port 27117 ace --eval 'db.VasyaPupkin.find().forEach(printjson);'
Выхлоп получаем приблизительно следующий:
MongoDB shell version: 2.6.12 connecting to: 127.0.0.1:27117/ace { "_id" : ObjectId("567bfd4fe4b0c81300ff3158"), "email" : "admin@company.com", "email_alert_enabled" : true, "email_alert_grouping_enabled" : true, "html_email_enabled" : true, "is_professional_installer" : false, "last_site_name" : "default", "name" : "admin", "requires_new_password" : false, "time_created" : NumberLong(1450966351), "ui_settings" : { "dashboardConfig" : { "dashboards" : { "5b4c57aadc236c7de53e3c3c" : { "order" : 1 } }, "lastActiveDashboardId" : "5b4c57aadc236c7de53e3c3c" }, "statisticsPreferBps" : true }, "x_shadow" : "$6$0YiSt9dQ$YrNKedOCjOP2xl3y9FhRasafdhbdfadamBKIjZ4l9Mm4cy/m49dt0bN.sYaFvgVb5vce45KypFe07iNYc1" }
Интересующее нас поле:
x_shadow" : "$6$0YiSt9dQ$YrNKedOCjOP2xl3y9FhRasafdhbdfadamBKIjZ4l9Mm4cy/m49dt0bN.sYaFvgVb5vce45KypFe07iNYc1"
После анализа
гугления узнаем, что алгоритм шифрования — SHA-512
crypt(3) compatible. Упс. Откладываем идею декрипта на дальнюю полочку и идем другим путем. Доступ к базе у нас есть, соответственно нужен просто хеш от известного нам пароля. А обновить запись в базе дело-то нехитрое. Идем на : Выбираем нужный алгоритм, вводим тот пароль, который будем использовать: Нажимаем волшебную Синенькую кнопочку: Полученный хеш аккуратненько копируем, далее он нам понадобится. И вот настало время для финального шага:
admin.mongo --port 27117 ace --eval 'db.admin.update({name:"admin"},{$set:{x_shadow:"$6$ee74396ce4c563de$oLm93BwJywYo1sUFgX8U0FC.p75t1Jv838.0defRCe36jgX6PU3h.m3NL6tjCs8Q/1Ymtge0DXz9shb//dyEN."}})'
Барабанная дробь… Нажимаем Enter.
MongoDB shell version: 2.6.12 connecting to: 127.0.0.1:27117/ace WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
Идем на страницу аутентификации контроллера UniFi, вводим имя пользователя: admin
(мы же ж для него пароль меняли), пароль вводим тот, для которого генерировали хеш. И, вуаля, все работает, доступы есть, все счастливы и танцуют.
Ubiquiti Controller Forgotten Password, Reset UniFi Administrator Password
Ubiquiti Controller forgotten password and unable to login! Recently, I’ve ran into this weird issue where I could not log into a Ubiquiti Controller for the life of me. I knew the password was correct because I had used it before and I’ve even had it written down. I’ve wasted countless hours trying out derivatives of the password that I had, mixing up capital letters etc. without any success. I still don’t know for sure why this happened, my best guess would be that I’ve picked a password that did not pass Ubiquiti’s password complexity requirements and thus causing it to lock me out. I am however surprised that it went through in the first place. If anyone out there know exactly why this happens please let me know in the comments below. Anyhow, here is the resolution I’ve found during my research on how to reset your UniFi controller admin password.
How to Reset an Ubiquiti Controller Password?
Step 1 – Download Robomongo
This amazing program will allow you to access the configuration files of the UniFi Controller. Not only does it allow you to access the files but it also lets you to edit the config files. An older version may be harder to find now so I am adding a direct link to the download below. All credit goes to Robomongo developers, you may visit them at Robo 3T.
Robomongo Download:
robomongo-0.9.0-rc4
Please make sure that you install the Robomongo software on the same computer UniFi Controller is running. Running it on a remote PC will not let you authenticate to the UniFi database. Once you have the program installed and running, please continue to step two.
Step 2 – Edit Ubiquiti UniFi Config Files
Open up the Robomongo software & connect to the Ubiquiti Database. The screenshots below will show you how this is done, address should be “localhost”
port should be “27117 “
.
Navigate your way to the ace > admin file
, there you will see the password in its encrypted format. Your password will be the longest line there in its encrypted form. Now we want to replace this password with another encrypted password, for that continue to step three.
Step 3 – Reset Ubiquiti Controller Administrator Password
We will head over to Quickhash
and download the program to generate a new encrypted password to be used with our UniFi controller.
Once you have generated a new password in its encrypted form, copy that data and replace the password field “x_shadow
“
in the Controller’s database as shown below.
Alternatively, you may also use the pre-created password that I have below and reset it to your own once logged in.
Encryption the password uses is : SHA-512 / crypt(3) / $6$
(just in case anyone is wondering)
Password:
ubuntu@1234
Encrypted Password:
$6$b98d16b2862d0445$oGME1OiFgQE/qamZFHw9Bh3t5BDgxHZoyebcb9QVThjI4Etd7X6imLVLwklBCIrQcHlffQVklKGrid6iTWnDt1
Step 4 – UniFi Controller Access & Login
Now you may try the login again using the password that you’ve set in step three. You should now be able to successfully sign in to the UniFi Controller. I would also restart the controller if it is already running just to double-check it is working properly.
If anyone has any idea why this issue occurs in the first place, I would appreciate it if you can shed some light on this problem in a comment below.
I hope this article was helpful for you in resolving the UniFi forgotten password issue. Thank You, for visiting & I hope you will stick around for more useful content.