Update/Reset UniFi Admin Password Manually

Ubiquiti's stringent password requirements, when running the first-time-wizard, can be a pain on their UniFI controller. When installing the controller for the first time, satisfy the requirements when the wizard asks you to, knowing that you can run the following cmds to get the password back to something you actually want :-)
 
Linux-based Ubiquiti Unifi Wireless Controller
 
♦ To create a salted, hashed password, do one of the following
 
  • For Ubuntu/Debian based distros, use the mkpasswd utility ('whois' pkg on Debian/Ubuntu):
    mkpasswd -m sha-512
  • For RHEL/CentOS/Fedora/ based distros, use python:
    python -c 'import crypt,getpass;pw=getpass.getpass(); print(crypt.crypt(pw), crypt.mksalt(crypt.METHOD_SHA512) if (pw==getpass.getpass("Confirm: ")) else exit())'
 
♦ To show the list of admins/users:
mongo --port 27117 ace --eval "db.admin.find().forEach(printjson);"
 
 
♦ To update the password in the mongodb database for UniFI (replacing [USERNAME] with the appropriate username and [HASHED_PASSWORD] with the result from the password generation utility).:
mongo --port 27117 ace --eval 'db.admin.update( { "name" : "[USERNAME]"}, { $set : { "x_shadow" : "[HASHED_PASSWORD]" } } )'