Professional SQL Editor For A Fraction Of The Price

Generating Key Pairs

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:

ssh-keygen -t rsa -b 2048 -C "[email protected]"

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.

ssh-keygen -t rsa -b 2048 -C "[email protected]"
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:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUmpg0xyLHVvs/ak8ppuawUV5c2LmZRxZ/6Sep87oE4P8j3zSweEaQlP7sE/AfcL3oQywQjTryZxhi+ihAvNKf3VNbyCl34Oodzgg8yqyXVVMMMmRINzx4vzjNRFaWDhrsWK2d4TP4LL57PVMPmvOVq/fmty+rqQ0L0+zOh55Rgkwjd8+x7QcyuS09BCdAneQ2Qo9XCixOKNvDS5tJ1MGy4ONiO+H8GNoP7fubRMQcOEQj74VgUHb1uSIByK7Azupxth6VtbpVYt3d7aetspLaMuJh8O1+8OAl+YRqwf5hWo4uAJgVeiBAaLeBBpwBH/mK0EV9E1y/5vilgyr0Qbmt sqltool
Windows

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:

Type of key to generate: SSH-2 RSA
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 comment: [email protected]
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:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUmpg0xyLHVvs/ak8ppuawUV5c2LmZRxZ/6Sep87oE4P8j3zSweEaQlP7sE/AfcL3oQywQjTryZxhi+ihAvNKf3VNbyCl34Oodzgg8yqyXVVMMMmRINzx4vzjNRFaWDhrsWK2d4TP4LL57PVMPmvOVq/fmty+rqQ0L0+zOh55Rgkwjd8+x7QcyuS09BCdAneQ2Qo9XCixOKNvDS5tJ1MGy4ONiO+H8GNoP7fubRMQcOEQj74VgUHb1uSIByK7Azupxth6VtbpVYt3d7aetspLaMuJh8O1+8OAl+YRqwf5hWo4uAJgVeiBAaLeBBpwBH/mK0EV9E1y/5vilgyr0Qbmt sqltool

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.