Skip to content
Jan 3 / Greg

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:

  • Configure a local radio the way you want.
  • Copy the config to notepad.
  • Paste it into the remote router.
  • Save and apply.
  • 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


    leave a comment
    1. iam8up / Jan 9 2012

      You’ll also like this if you work with lots of (new) AirOS devices. Template and updating automatically.

    2. Greg / Jan 12 2012

      If for no other reason than the URL name I approve…hehe

    3. iam8up / Jan 16 2012

      Whoops, the link should be

    4. Phil / May 18 2012

      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!)

    5. Greg / May 18 2012

      No worries.

    6. Kojek / Oct 9 2014

      Many thank’s sir….this is very helpfull for me…

    7. psilo / Jul 4 2016


      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?


    8. Greg / Jul 5 2016

      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.

    9. Benjamin / Mar 27 2017

      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 🙂

    10. Greg / Mar 28 2017

      @Ben, many thanks for the tip sir.

    11. Cody / Dec 18 2020

      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.

    Leave a Comment