You will need a hash of the password to put into the database. We don’t cover that in this post. You could copy the password from a different user account or use a different UniFi instance to change the password and then check the DB to find the hash.
SSH into the UniFi Server
ssh unifiadmin@unifiserver
Connect to MongoDB
Connect to Mongo by typing in the following.
mongo -port 27117
Then select the ace database by typing
use ace
Find user ObjectId
The admins are in the admin collection/table. Use the following command to list all the users and their name, email, and password hash.
The following looks complex. Fortunately though you should be able to copy and paste. You should only need to change the – ObjectId to your User Id – Password Hash to your password hash
Sometimes it is nice to have a list of just the IP addresses and the hostname or mac address. Can be especially helpful when you are trying to get a list of devices to do a bulk update in LibreNMS. Helpful LibreNMS links for renaming and showing down devices
we are going to run the command to pull the DHCP information and then use Unix utilities to parse the data out.
Replace dhcp8 with the correct dhcp server in the mikrotik.
First, SSH into your Mikrotik router.
ssh user@mikrotik
Next we’ll want to go to the ip dhcp-server lease directory
/ip dhcp-server lease
Now we can run the following command to loop through and pull out all the info we need. You can change the info like “mac-address” for something like “status”. You can use Tab to see what options are available. Just delete mac-address and hit tab twice.
For some reason I ran into an issue where I can not remove authorized SSH Keys in AirOS version 6.3. It redirects to a 404 page and then to the main page.
Thankfully, we can still remove the authorized keys from the command line. For more information on making changes over SSH, refer to the following post.
SSH into radio. Replace username and IP address with your radios user and IP.
ssh ubnt@192.168.1.20
Open up config file
vi /tmp/system.cfg
Search for the lines that contain
the sshd.auth.key and remove them
Save the file and write the configuration with
/usr/etc/rc.d/rc.softrestart save
Once the command completes, you should be good to go.
nvram_
nvram_get nvram_set
nvram_get
Usage:
nvram_get [] []
command:
rt2860_nvram_show - display rt2860 values in nvram
rtdev_nvram_show - display 2nd ralink device values in nvram
show - display values in nvram for
gen - generate config file from nvram for
renew - replace nvram values for with
clear - clear all entries in nvram for
platform:
2860 - rt2860
rtdev - 2nd ralink device
file:
- file name for renew command
nvram_get show
2860
nvram_get show 2860
Log into the GUI and verify everything looks correct. Under the network tab it was still showing that it had a static address, although it pulled a DHCP IP.