How To Create SSH Key Pair for Oracle Cloud

We connect to all servers that we create in Oracle Cloud environment with ssh public and private key. When creating our database server or normal servers, it will ask us for “ssh public key”. Using private key, it is possible to provide secure and passwordless connection.

You can use the following methods to create an SSH key pair (public and private).

Create SSH Key Pair for Unix, Linux

If you want to connect to cloud servers from a linux or unix machine, you can create a ssh key pair as follows. Our key must be 2048 bit and RSA type.

When the command is executed, it will ask for a password. The operation can be done without typing the password. This password will be required to use the private key. If no password is specified, private key can be used without password.

There will be two files with the specified name. In the example above, the file mykey.pub is public key and the file mykey is private key. Public key content will be used on servers in Oracle Cloud environment and private key will be used on machines that will connect to cloud.

Create SSH Key Pair for Windows

You can use PuttyGen (Putty Key Generator) program. PuttyGen will be available after installing the Putty software which can be downloaded from https://www.putty.org/. With PuttyGen you can create ssh key pair as follows.

Select RSA from “Type of key to generate“, type 2048 in the value of “Number of bits in a generated key” and click the Generate button.

By moving the mouse pointer randomly in the empty area, complete the progress bar.

Copy and paste the information in the field “Public key for pasting into OpenSSH authorizek_keys file” into a text editor and save it with a name such as mykey.pub. Be sure to copy the information in the field completely.

After the operation, the public key will be ready. For private key, click Save private key. Confirm it on the screen and save it with the name we use for public key, with a .ppk extension.

At the end of these operations, two files will be created: mykey.pub for public key and mykey.ppk for private key.