Edit Ubiquiti Configs Via SSH
First things first, enable SSH access on your device.
Some of the basic configs are easy to understand like the bridge connection and hostname…others not so much. The best thing to do is that if you can only gain SSH access to a remote device and aren’t able to connect via the web, then:
The config file is located at “/tmp/system.cfg”. To edit the file, use VI.
vi /tmp/system.cfg |
Once you have edited your config file, you must save it to flash:
cfgmtd -f /tmp/system.cfg -w |
Once you have saved it you can reboot by issuing the “reboot” command or you can do a soft apply:
/usr/etc/rc.d/rc.softrestart save |
You’ll also like this if you work with lots of (new) AirOS devices. Template and updating automatically.
http://stfunoo.be/?cat=14
@8up
If for no other reason than the URL name I approve…hehe
Whoops, the link should be
http://stfunoo.be/?p=1120
Thanks for this, super helpful! (I had a UBNT box that wasn’t acting quite right and needed to see all of its settings in one place, had no idea they were in /tmp/system.cfg!)
@Phil
No worries.
Many thank’s sir….this is very helpfull for me…
G’day,
Know if there’s a way to save command-line configuration changes beyond the reach of the web interface? For example, more complex traffic bandwidth policing than simply ingress egress on interfaces. (Eg, source dest considerations). Presumably it’s easy enough to make the changes in the SSH interface, but they wouldn’t survive a reboot?
Ben
Psilo, I do believe you can make changes and save them across reboots here. A word of caution, anything in the config file not seen by the GUI may be overwritten when making normal changes through the GUI.
Thanks for the very helpful information. One problem I found: if you invoke the command ‘cfgmtd -f /tmp/system.cfg -w’ and reboot, then your Ubiquiti device ssh keys get regenerated resulting in a blocked connection by your client and a scary warning the next time you try to log in. I learned that if you add ‘-p /etc/’ to the end of the command it will stop the ssh keys from changing. Whole command: cfgmtd -f /tmp/system.cfg -w -p /etc/
It seems like that detail would be helpful if included in you your post.
Cheers 🙂
@Ben, many thanks for the tip sir.
You’re commands always seem to help when I need it most.
Managed to ssh into a ubnt radio to commit a change when the web gui wasn’t responding for like an hour.