User Tools

Site Tools


ubiquiti:site:change_the_default_site

Ubiquiti - Site - Change the Default Site

It is not possible to change which site is considered the default within the UniFi UI.

  • This can be done by manipulating the mongo database.

Access the CLI

SSH into the UniFi controller.


Start the Mongo Database

mongo --port 27117

Switch to the UniFi database

use ace

List the sites in the database

db.site.find()

returns:

{ "_id" : ObjectId("[hex number 1]"), "name" : "default", "desc" : "Default", "attr_hidden_id" : "default", "attr_no_delete" : true }
{ "_id" : ObjectId("[hex number 2]"), "desc" : "Site 2", "name" : "utn68o25", "location_lat" : 10.3245, "location_lng" : -24.5703, "location_accuracy" : 0 }

NOTE: This should list several sites.

  • Notice the differences in properties between the default site and the the other sites.

Change the properties for the replacement default site

Remove the default properties from the current default site and assign them to the site which is to become the new default site

db.site.update({ _id: ObjectId("[hex number 1]") },{ $unset: { attr_hidden_id: "",attr_no_delete: ""}})
db.site.update({ _id: ObjectId("[hex number 2]") }, { $set: { attr_hidden_id: "default", attr_no_delete: TRUE}})

Verify the changes

db.site.find()

Exit the mongo CLI

exit

NOTE: Restart the UniFi service for the changes to take effect.


Optionally delete the original default site

After the UniFi controller has restarted, the original default site can be deleted on the Site page of the UniFi Settings.

NOTE: Once the old default site is deleted from within the controller UI:

  • Re-enter mongo
  • Update the replacement site as the default site name to default so that it is addressable with default in the controller URL <https://unifi:8443/manage/default>
db.site.update({ _id: ObjectId("[hex number 2]") }, { $set: { name: "default"}})

Rename the old default site

The old default site does not have to be deleted.

  • But the name of the old site will need to be changed; so that two sites are not both named default:
db.site.update({ _id: ObjectId("[hex number 1]") }, { $set: { name: "[any unique 8-char alphanumeric string]"}})

ubiquiti/site/change_the_default_site.txt · Last modified: 2022/10/10 20:21 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki