info_i_25x25.png Due to unforeseen weather conditions we are experiencing higher chat wait times. Remember you can also submit a ticket and one of our support representatives will get back to you as soon as possible. We apologize for the inconvenience.

UniFi - Changing Default Ports for Controller and UAPs


Overview


This article describes how to change ports from their default assignments. Find the different default ports in our UniFi - Ports Used article.


Table of Contents


  1. Steps - How to Change Ports
  2. Example (Windows)
  3. Finding Your Log Files
  4. Video Tutorial
  5. User Tips & Notes
  6. Related Articles

Steps - How to Change Ports


Back to Top

UniFi gives operators the freedom to change these ports from their default assignments. By using a network utility (netstat, etc.), users can determine which ports are in use/opened/closed. The steps are outlined below:

  1. Close any instances of UniFi software (Controller).
  2. Modify the file system.properties accordingly—the file can be found in the directory <unifi_base>/data/system.properties. See this article for more on <unifi_base>.
  3. Make sure all ports needed by UniFi are available (see this article).
  4. Restart UniFi.
ATTENTION: Make sure there are no leading or trailing spaces, comments, or other characters on any custom lines as the Controller will ignore your customizations if there are.

Example (Windows)


Back to Top

  1. Run "netstat - ano" command in the command line.
  2. Locate the PID (process identifiers) for the mentioned port in use.
  3. Open task manager, select view and select columns, put a check for PID.
  4. Check the process corresponding to the PID located for the port during step 2.
  5. End the process if it is possible.
  6. If not possible go on the location <unifi_base>/data and open the system file with word or notepad.
  7. Modify this file to change the port that was in use.  For example if port 8081 was in use you would modify the line unifi.shutdown.port=8081 to something like unifi.shutdown.port=8089 assuming port 8089 was not already in use.
NOTE: If the Controller software has never been run, the system.properties file won't exist yet. You can run the UniFi Discovery Utility or the UniFi Controller software (if no port conflict exists) to generate it.
 
Windows or Mac will have an icon for the UniFi Discovery Utility but Linux will not. Users on Linux will have to load it via CLI with the following command:
java -jar /usr/lib/unifi/lib/ace.jar discover

Log Files Location


Back to Top

Log files will be essential for any troubleshooting you might perform. Find them here:

  • /usr/lib/unifi/logs/server.log
  • /usr/lib/unifi/logs/mongod.log
NOTE: If your controller is running on a Unix/Linux based system, then you will require superuser (sudo) privileges to access these log files. Unfamiliar with sudo? This external article might help. 

Video Tutorial


Back to Top

NOTE: The following video is based on v2.x. However, the system.properties file still rests in the same directory <unifi_base>/data/system.properties in v3, v4 and v5.

 


User Tips & Notes


Back to Top

  • As mentioned in the warning above, if you customize any ports or system variables you need to make sure there are no comments (#), or extra characters leading or trailing on the line. If the variable you want to customize is in the commented section it is recommended that you copy just the variable, paste it below the commented section and customize as needed.
  • If you're modifying the system.properties file on a Unix/Linux system, please note that it will require super user (sudo) privileges to edit the file. There are no special requirements other than that, so you can use your preferred text editor (vi, emacs, nano, etc.).
  • Since UniFi Controller version 5.6.x the UniFi service does not run as root. This means that you cannot bind to privileged ports (<1024). The controller will fail to start if you try to use these ports.

Related Articles


Back to Top

UniFi - Explaining the system.properties File

UniFi - Ports Used

UniFi - Where is <unifi_base>?