OCI - Create a Linux public instance using keypair generated with Putty-keygen

Create a Linux public instance using keypair generated with Putty-keygen
Disclaimer :

There are lots of wrong and right articles in internet, when you try to execute Hands-on Labs by yourself, there is chance that you could get drifted away or get severely confused, We strictly adhere to Official Oracle Cloud Documentation, offering you reliable and precise information without personal interpretations. This means you can trust our content 100% Genuine.

Prerequisites

Before you create a VCN and Subnets, ensure you have the following:

  • An active OCI account.
  • Necessary IAM policies to create and manage networking components.
  • A clear plan of your network topology and CIDR blocks to avoid overlapping IP addresses.

Lab Task:

Create a Linux public instance using keypair generated with Putty-keygen

Lab Task Explanation:

Before we begin the Lab we need to create the SSH keypair using Putty-keygen Commands in Putty (GUI).

At the time of Instance creation, you will be presented with option to upload or paste the public key, use any of this option to create a New Instance.

Lab Task Flow

    Task 1: Prepare a clear sample Architectural Diagram

    Our OCI Architectural diagram for this Lab is

    img:Instance with Public key

    Note : If you want to create such Cloud Architectural diagrams check this link Click here :

    Task 2: Create Key Pairs using Putty key-generator

    Regarding this Lab we are going to Generated key pair using Gui - Putty Key generator.

    Note : In case of any doubt - Jump to the Detailed vedio explantion given below

    1. Goto putty.org Download and install PuTTY.
    2. Find puttygen.exe in the installed PuTTY folder on your computer, for example, C:\Program Files (x86)\PuTTY. Double-click puttygen.exe to open it.
    3. Specify a key type of SSH-2 RSA and a key size of 2048 bits.
    4. In the Key menu, confirm that the default value of SSH-2 RSA key is selected.
    5. For the Type of key to generate, accept the default key type of RSA.
    6. Set the Number of bits in a generated key to 2048 if not already set.
    7. Click Generate.
    8. To generate random data in the key, move your mouse around the blank area in the PuTTY window.
    9. When the key is generated, it appears under Public key for pasting into OpenSSH authorized_keys file.
    10. img: putty keygeneration
    11. A Key comment is generated for you, including the date and timestamp. You can keep the default comment or replace it with your own more descriptive comment.
    12. Leave the Key passphrase field blank.
    13. Click Save private key, and then click Yes in the prompt about saving the key without a passphrase. The key pair is saved in the PuTTY Private Key (PPK) format, which is a proprietary format that works only with the PuTTY tool set. You can name the key anything you want, but use the ppk file extension. For example, mykey.ppk.
    14. Select all of the generated key that appears under Public key for pasting into OpenSSH authorized_keys file, copy it using Ctrl + C, paste it into a text file, and then save the file in the same location as the private key. (Do not use Save public key because it does not save the key in the OpenSSH format.) You can name the key anything you want, but for consistency, use the same name as the private key and a file extension of pub. For example, mykey.pub.
    15. Write down the names and location of your public and private key files. You need the public key when creating an instance console connection. You need the private key to connect to the instance console connection using PuTTY.

    Task 3: Create Linux Public instance using keypair generated with Putty-keygen

    Step 1: Identify Sample Input
    • Subnet A is Public subnet.
    • Subnet A should have CIDR ip of 10.0.1.0/29.
    • Instance should have a private ip of 10.0.1.5.
    • Instance should be a Linux machine.
    Step 2: Create a Linux Instance Using OCI Generated Keys downloaded from OCI Web Console
    Precautions

    When creating your instance and generating your keypair, remember to keep your private key secure. It’s also important to choose a strong passphrase (optional) for your keypair to ensure the security of your instance.


    1. Sign in to the OCI console.
    2. Open the navigation menu and click Compute > Instances.
    3. Click Create Instance.
    4. In the Create Compute Instance dialog box, provide the necessary information for your instance.
    5. In the Add SSH Keys section, select Paste SSH keys and paste the public key code which we copied previously.
    6. Description of the image
    7. Click Create to create your instance.

Detailed Video Explanation:

Required concept knowledge

    Types of Keys?

    img: Keypairs

    There are two types of Keys in a Key pair - public key and private key

    Use of SSH Keypair?

    • You provide the public key when you create an instance.
    • And you keep the private key on a safe place.
    • When you connect to the instance using SSH, you provide the path to the private key in the SSH command.
    • The public key will be compared with private key for authentication.
    • Thus by using both keys you can create and get connected to your instance and do your administrative tasks.

    What is "SSH" in SSH keypair means?

    • The Secure Shell (SSH) protocol is a method for securely sending commands to a computer or a server over an unsecured network.
    • The SSH network protocol encrypts all traffic between the client and the server while it is in transit.
    • SSH utilizes public key cryptography, which involves the use of public and private keys to authenticate and establish a secure connection.
    • Thus anyone who requires managing a computer remotely namely, System and network administrators use this protocol to manage remote servers and machines, they can connect to a server and run commands as if they were sitting at the machine.

    Difference in Creating Linux Instance and Windows Instance

      web console keypair creation

    when is the Key pair generated

    Linux / Unix instance Windows instance
    Linux instances use an SSH keypair instead of a password to authenticate a remote user. Windows instances use username & password to authenticate a remote user.
  • Download keypair from pre-given OCI Web Console.
  • Generated keypair with ssh-keygen commands.
    1. using OCI "cloudshell" terminal.
    2. using windows "powershell".
    3. using windows "cmd" command prompt
    4. using "Gitbash" (old windows ver)
    5. using Open SSH tools (wsl2)
  • Generated keypair using GUI - PuTTY Key generator.
  • Usernames & passwords are provided by OCI at the time of instance creation.

    What is Putty Key-generator?

    • PuTTYgen is an key generator tool for creating SSH keys for PuTTY. It is analogous to the ssh-keygen tool used in some other SSH implementations. The basic function is to create public and private key pairs. PuTTY stores keys in its own format in . ppk files. Although PuTTYgen collects keys in its native file format i.e. ".ppk" files, the keys can easily be converted to any file format.
    • PuTTYgen.exe is the graphical tool on Windows OS. While on the other side, Linux OS has the only command-line version could be accessible using SSH commands.
    • Although originally written for Microsoft Windows operating system, it is now officially available for multiple operating systems including macOS, Linux. For Windows, the software interface is PuTTYgen.exe, whereas, for Linux OS the command-line adaptation is available using SSH commands.

Post a Comment