- Extract the SSH client public key from the zip file.
- Convert the SSH client public key file from DER to PEM format.
- Configure the SSH client public key on the SSH server and disable non-key-based authentication modes.
Extract the public key
Perform the following steps to extract the SSH client public key from the zip file:1
Log in to the SSH server machine as the user you plan to connect with from the SSH client machine.
2
Open a terminal session and go to the location of the SSH client public key zip file exported from the CryptoHub.
3
Run the following command to extract the SSH client public key from the zip file, modifying the file name to match the actual name of your file.The
Shell
You should see the following output:
None
SSH.pub file is in DER format, meaning the public key is binary encoded.Convert the public key file
This section uses OpenSSL to convert theSSH.pub file from DER to PEM format. PEM is a method of encoding binary data as a string (also known as ASCII armor).
Perform the following steps to convert the SSH client public key file from DER to PEM format:
1
Run the following OpenSSL command to convert the public key exported from the CryptoHub in
DER format to PEM format (as required for the ssh-keygen command in the next section):Shell
Configure the public key
Perform the following steps to configure the SSH client public key on the SSH server and disable non-key-based modes of authentication:1
SSH requires a specific format for the public keys used within an SSH session. Run the following ssh-keygen command to convert the
SSH_pubkey.pem file from the previous command to the required SSH public key format and add it to the ~/.ssh/authorized_keys file:Shell
2
Run the following command to open the SSH daemon configuration file:
Editing this file requires sudo privileges.
Shell
3
Inside the file, confirm the following directive is present:
Text
4
Optionally, you can also set the following directives to make the SSH daemon only respond to SSH keys:
Text
5
Save and close the file when finished. To implement these changes, restart the SSH service.On Ubuntu or Debian machines, run the following command:On CentOS or Fedora machines, run the following command:
Shell
Shell

