Adding an SSH Public Key

To access an instance using SSH, generate at least one SSH key pair and upload the SSH public key that should be associated with the instance to Compute Classic. You’ll use this SSH key to access your instance later on, when your instance is running.


You can’t use SSH keys to log in to a Windows instance. To log in to your Windows instance using RDP, see Accessing a Windows Instance Using RDP.


  • To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

  • You must have generated an SSH key pair. See Generating an SSH Key Pair.


  1. Sign in to the Compute Classic console. If your domain spans multiple sites, select the appropriate site. To change the site, click the Site menu near the top of the page.
  2. Click the Network tab, and then in the Network drop-down list, click SSH Public Keys.
    The SSH Public Keys page is displayed.
  3. Click Add SSH Public Key.
  4. Enter or select the following details:
    • Enter a name for the key.

      Choose a name that you can use to identify the key easily.

    • In the Value field, click Select File. Navigate to the path where your SSH key is saved, and select the SSH public key file that you want to add. The value of the SSH key appears in the field.

      Alternatively, you can paste the value of the SSH public key that you want to add.


      Paste the key value exactly as it was generated. Don’t append or insert any spaces, characters, or line breaks.

      See the following example:

      Screenshot showing an example of an SSH public key entered in the Value field.

    • To enable the key, select the Enabled check box. Alternatively, you can deselect the check box and enable the key later.

  5. Click Add.

After adding an SSH public key, you can attach it to an instance when you create the instance.

To add an SSH public key using the CLI, use the opc compute ssh-key add command. For help with that command, run the command with the -h option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.

To add an SSH public key using the API, use the POST /sshkey/ method. For more information, see REST API for Oracle Cloud Infrastructure Compute Classic.