This article demonstrates how to reconfigure an existing SSH node to use Public Key Authentication.
If you wish to see this article as a rolling demo, there is a Youtube Video available which you may watch instead.
Step 1: Create a new Key
Navigate to Private Keys and click Generate Key.
Give the key a name and select the Type and Bit length for the key. You can choose between RSA, DSA and ECDSA for the Type and 1024, 2048 and 4096 for Bits.
Click Generate Key.
Step 2: Install Public Key on SSH server
Click the green gears icon and select Download Public Key. We will need this to upload to the SSH server shortly.
Open the downloaded pub file and copy the contents to the clipboard.
In this example, we already have a Gateway Node configured for the target SSH Server, but it is configured to use Username and Password authentication.
We can therefore connect to the node using the SSH Gateway, using the nshell command.
In the node, cd into the .ssh directory and paste the contents of the key into the authorized_keys file.
Exit from the node when finished.
Step 3: Reconfigure Gateway Node
Back in the web UI, navigate to Gateway Nodes and edit the existing node we just connected to.
Select the Authentication tab and change the Authentication Mode to Public Key, then in the next drop down select the Private Key that we created earlier.
Click Update to save the resource.
Step 4: Testing
Back in PuTTY, let's reconnect to the node using nshell and check the logs to ensure we actually did connect using the public key.