cloud, macOS

Generate an SSH key on macOS for Oracle Cloud Services

Generate an SSH key on macOS (Sierra 10.12.3)

 

If you plan on using the Oracle Cloud Services, you will need to generate some SSH Keys to enable secure access to Oracle Cloud resources from applications such as SQL Developer and even terminal connections. Below I will outline the process for creating SSH Keys on macOS.

Generating an SSH key with macOS is relatively straight forward using the variety of Terminal applications available for the OS.

I have written this post as part of a prereq documentation for building on Oracle Cloud Services, but the step apply regardless of your objective. There are plenty of places documenting these steps for both Windows and Linux

Open the Terminal application

To open the a terminal application you can either find it in the Dock, but if it’s not there, follow these steps:

  1. Click theĀ Applications icon in the dock
  2. Search for and click the Utilities folder
  3. Launch the Terminal application
SSH terminal image
Terminal Application on macOS

Generate the ssh key

Once your terminal window is open, to generate the ssh key, follow these steps:

1. Change to the ~/.ssh directory. This will ensure that the ssh keys will be saved in your .ssh directory.
Danny: > cd .ssh
2. Execute ssh-keygen -t rsa to start the process
Danny: > ssh-keygen -t rsa
Generating public/private rsa key pair.
3. Provide a name the key files generated. In this example I have called it "cloudKey"
Enter file in which to save the key (/Users/username/.ssh/id_rsa): cloudKey
4. Enter a passphrase. Please remember this passphrase, you will need it later.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in cloudKey.
Your public key has been saved in cloudKey.pub.
The key fingerprint is:
SHA256:xxxxxxxxxxXXXXXXXXXXxxxxxxxxxxXXXXXXXXXXxxx username@computername
The key's randomart image is:
+---[RSA 2048]----+
|4einc            |
|hhhh             |
|+.+. .           |
|*oo= . o         |
|+B= o E S        |
|B=cc o           |
|=+=.. .          |
|ooo-=  .o        |
|grdB..ot         |
+----[SHA256]-----+

Your private key is saved as “cloudKey” and your public key is “cloudKey.pub” both in the ~/.ssh directory. Next steps will be use these files to enable secure remote access without the need to use passwords.

Once you have completed this, you can now use the generated keys to populate the SSH Key dialogue box.

Take a look at the following blog posts for examples on how you can use this to connect to the Oracle Database Cloud Service.

Establish SSH Connection to Oracle Database Cloud Service with SQL Developer

SSH Into the Oracle Database Cloud Service

Enjoy!

Related Posts Plugin for WordPress, Blogger...

1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.