Configure the SSH server
Perform the following steps to configure the SSH Client Public Key on the SSH Server and disable non-key-based modes of authentication:
Log in to the SSH server machine as the root user.
Open a terminal session and go to the location of the SSH client public key file that you exported from the .
Run the following OpenSSL command to convert the public key that was exported from the from DER format to PEM format (this is required for the ssh-keygen command in step 4):
SSH requires a specific format for the public keys used within an SSH session. Run the following ssh-keygen command to convert the SSH_Client_Public.pem file that was output from the previous command to the required SSH public key format, and add it to the ~/.ssh/authorized_keys file:
Open the SSH daemon configuration file:
Inside the file, make sure that the following directive is set:
Optionally, you can set the following directives as well to make the SSH daemon respond only to SSH keys:
Save and close the file when finished. You must restart the SSH service to apply the changes.
On Ubuntu or Debian machines, issue the following command:
On CentOS/Fedora machines, the daemon is called sshd: