Connecting to a Linux Instance using PuTTY and Windows

PuTTY is a free implementation of SSH and Telnet for Windows. The program includes an xterm terminal emulator. PuTTY generates its own public and private SSH keys but can interoperate with OpenSSH keys. Before OpenSSH was included with Windows 10 and Windows Server 2019, PuTTY was a primary tool for making SSH connections to Unix systems. You can download and install PuTTY and PuTTYgen from http://www.putty.org.

Connecting to a Linux Instance from a Windows System Using PuTTY

SSH private key files generated by Oracle Cloud Infrastructure are not compatible with PuTTY. If you use a private key file that was generated during the instance creation process, you must convert the file to a .ppk file before you can use it with PuTTY to connect to the instance.

Convert a generated .key private key file:

  1. Open PuTTYgen.

  2. Click Load, and select the private key that was generated when you created the instance. The extension for the key file is .key.

  3. Click Save private key.

  4. Specify a name for the key. The extension for new private key is .ppk.

  5. Click Save.

    Note

    PuTTYgen does not overwrite the .key file but creates an additional file of the same name with the .ppk extension.

Connect to the Linux instance using a .ppk private key file:

If the instance uses a key pair that you created using PuTTY Key Generator, use the following procedure.

  1. Open PuTTY.
  2. In the Category pane, select Session and enter the following:

    • Host Name (or IP address):

      <username>@<public-ip-address>

      <username> is the default username for the instance. For Oracle Linux and Redhat Enterprise Linux compatible images, the default username is opc. For Ubuntu images, the default username is ubuntu.

      <public-ip-address> is the instance's public IP address that you retrieved from the Console

    • Port: 22
    • Connection type: SSH
  3. In the Category pane, expand Window, and then select Translation.
  4. In the Remote character set menu, select UTF-8. The default locale setting on Linux-based instances is UTF-8, and this configures PuTTY to use the same locale.
  5. In the Category pane, expand Connection, expand SSH, expand Auth, and click Credentials.
  6. Click Browse, and then select the .ppk private key file.

  7. Click Open to start the session.

    If this is the first time connecting to the instance, then you might receive a message that the server's host key isn't cached in the registry. Click Yes to continue the connection.

  8. Type exit at the shell prompt to end the session.
Note

If the connection fails and you are not behind a proxy, then ensure that Proxy type in the PuTTY configuration is set to None. If you are behind a proxy, then select the proxy type and enter the proxy host name and port number.
Note

If you changed the file permissions on the key to connect from a Windows system using OpenSSH, then the key will not work with a PuTTY connection. Use OpenSSH to connect instead.
Note

For SSH troubleshooting suggestions, see Troubleshooting the SSH Connection.

Creating an SSH Key Pair Using PuTTY Key Generator

To create an OpenSSH key pair with PuTTY, follow these steps:

  1. Find puttygen.exe in the PuTTY folder on your computer, for example, C:\Program Files (x86)\PuTTY. Double-click puttygen.exe to open it.
  2. Specify a key type of SSH-2 RSA and a key size of 2048 bits:

    • In the Key menu, confirm that the default value of SSH-2 RSA key is selected.
    • For the Type of key to generate, accept the default key type of RSA.
    • Set the Number of bits in a generated key to 2048 if it is not already set.
  3. Click Generate.
  4. Move your mouse around the blank area in the PuTTY window to generate random data in the key.

    When the key is generated, it appears under Public key for pasting into OpenSSH authorized_keys file.

  5. A Key comment is generated for you, including the date and time stamp. You can keep the default comment or replace it with your own more descriptive comment.
  6. Leave the Key passphrase field blank.
  7. 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.

  8. 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.

  9. Write down the names and location of your public and private key files. You will need the public key when launching an instance. You will need the private key to access the instance via SSH.

Now that you have a key pair, you're ready to launch instances as described in Creating an Instance.

Important

Setting a private key passphrase can be inconvenient as you are prompted for it every time you use PuTTY with SSH. Please follow the security policies of your organization when considering the choice.