SSH keys are a great way to establish a secure connection between you and a server. When generating keys, a private and public key will be created. The private key is meant for your eyes only and should not be shared with anyone. The public key should be loaded to the server in which you're trying to establish a secure connection.
Mac & Linux
From a terminal enter the following command and follow the prompts:
Usually the default save location is fine for an SSH key set and for the sake of this document it will be fine. When prompted for a password it is recommended that you enter at least eight characters for added security. It is not a good idea to use a password-less private key.
The following is the information shown in a Mac terminal when stepping through the generation process.
Generating public/private rsa key pair.
Enter file in which to save the key (~/.ssh/id_rsa): [Press Enter]
Enter passphrase (empty for no passphrase): sqltoolpro
Enter same passphrase again: sqltoolpro
After completing the steps you will be left with a public and private key in OpenSSH format. This public key is intented to be distributed to any server in which you wish to securely connect with. Give it to the server administrator or append it to a new line in the ~/.ssh/authorized_keys file on the server you wish to connect. The key will look something like as follows with no line breaks:
The common method for generating SSH keys on Windows is to make use of the PuTTYgen tool. On the main screen of the tool make sure the settings read as follows:
Number of bits in a generated key: 2048
Click the Generate button and move the cursor around on the screen to generate randomness. When complete make sure to fill in the form fields as follows remembing to make your passphrase eight characters or longer for added security:
Key passphrase: sqltoolpro
Confirm key passphrase: sqltoolpro
After completing the steps you will be left with a public key in OpenSSH format. This key is intented to be distributed to any server in which you wish to securely connect with. Give it to the server administrator or append it to a new line in the ~/.ssh/authorized_keys file on the server you wish to connect. The key will look something like as follows with no line breaks:
If planning on using SSH keys with SQLTool, the private key must be saved in OpenSSH format as well which is not the default in PuTTYgen. To convert the private key to OpenSSH format, open the menu item Conversions and choose Export OpenSSH key. Save to a path of your choice and if intended use is with SQLTool, give the private key a .key file extension.