UniFi - Adding SSH Keys to UniFi Devices


Overview


This article provides the steps on how to add SSH keys to your UniFi Network devices. This implementation is done per-site and without the need for custom files placed on the UniFi Controller host.


Table of Contents


  1. How to Add SSH Keys on Windows
  2. How to Add SSH Keys on macOS/Linux
  3. Related Articles

How to Add SSH Keys on Windows


Back to Top

Generate an SSH Key:

1. Install Putty (external link)

2. Open Putty Key Generator (Puttygen).

3. Select RSA with a key size of 2048.

4. Click Generate.

5. Move your cursor around the blank area above the "actions" section to generate a key. 

6. After the key has generated save the public key and private key in a secure location on your PC. Remember to never share your private key! 

Importing the private SSH key into PuTTY:

1. Enter a UniFi device IP or hostname under Session. For previously saved profiles go directly to step 2.

2. Navigate to Connection > SSH > Auth.

3. Click the "Browse" button under "Authentication parameters"

4. Locate the previously generated private key and click "Open".

5. Finally, click "Open" again to log into the remote server with key pair authentication.


How to Add SSH Keys on macOS/Linux


Back to Top

Generate an SSH Key:

1. Open a terminal on your machine and input the following:

ssh-keygen -t rsa

2. Hit enter to use the default file name or use a file name of your choice.

View the Public Key (needed for step 4 in the importing section):

1. Open a terminal on your machine and input the following:

cat ~/.ssh/id_rsa.pub
NOTE: The filename may be different depending on what it was named.

Import the public SSH key into UniFi:

1. In the UniFi Controller navigate to Settings > Site > Device Authentication.

Screen_Shot_2018-11-02_at_10.47.29_AM.png

2. Click "Add New SSH Key".

3. Name the key for future reference. It can be any name. 

4. Open the public key file, copy and paste the contents of the key into the "Key" section of the import window. 

5. Click "Add". 

6. Hit enter or select "Apply Changes" in the Site menu.

7. The UniFi devices will be provisioned with the public key upon clicking "Apply Changes".

Screen_Shot_2018-11-02_at_10.49.05_AM.png


Related Articles


Back to Top

Intro to Networking - How to Establish a Connection Using SSH

UniFi - Explaining the config.properties File


We're sorry to hear that!