If you are on Mac or Linux, open Terminal.
Paste something like the text below substituting in your email address or an identifier for the key.
$ ssh-keygen -t rsa -b 4096 -C "$identifier"
where $identifier is either your email address or something else.
When you’re prompted to “Enter a file in which to save the key,” press Enter.
This accepts the default file location.
At the prompt, type a secure passphrase if you so chooses to implement that additional security step.
Create a ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.
touch ~/.ssh/config
Start the ssh-agent in the background.
$ eval "$(ssh-agent -s)"
Then modify the file you created earlier:
cd .ssh && vi ~/.ssh/config
Add this to the file:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Add your SSH private key to the ssh-agent and store your passphrase in the keychain.
$ ssh-add -K ~/.ssh/id_rsa
Confirm the key existence:
$ ls -al ~/.ssh
Now copy the generated public key you will add to the cPanel server:
$ cat .ssh/id_rsa.pub
Login to cPanel and scroll down to Security >> SSH Access
To import an existing SSH key, perform the following steps:
Click Manage SSH Keys.
Click Import Key and copy the id_rsa.pub you generated.
To use a custom key name, enter the key name in the Choose a name for this key (defaults to id_dsa) text box.
Paste the public and private keys into the appropriate text boxes.
Click Import.
Now, you must authorize new keys before you attempt to use them.
So go back and click Manage to manage authorization for the key.
A new interface will appear.
Click Authorize to authorize the key, or Deauthorize to revoke authorization for the key.
Windows has a different workflow but these will help:
https://winscp.net/eng/docs/guide_windows_openssh_server
https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement
https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview
https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse