Connecting to Your Instance

You connect to a running Linux instance using a Secure Shell (SSH) connection. Most Linux distributions include an SSH client by default. Windows 10 and Windows Server 2019 systems should include the OpenSSH client, which you'll need if you created your instance using the SSH keys generated by Oracle Cloud Infrastructure. For other Windows versions, you can download a free SSH client called PuTTY from http://www.putty.org.

Before You Begin

Connecting to Your Linux Instance Using SSH

Log in to the instance using SSH.

To connect to a Linux instance from a Unix-style system
  1. Use the following command to set the file permissions so that only you can read the file:

    $ chmod 400 <private_key>

    <private_key> is the full path and name of the file that contains the private key associated with the instance you want to access.

  2. Use the following SSH command to access the instance.

    $ ssh –i <private_key> <username>@<public-ip-address>

    <private_key> is the full path and name of the file that contains the private key associated with the instance you want to access.

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

    <public-ip-address> is your instance IP address that you retrieved from the Console.

To connect to a Linux instance from a Windows system using OpenSSH
  1. If this is the first time you are using this key pair, you must set the file permissions so that only you can read the file. Do the following:

    1. In Windows Explorer, navigate to the private key file, right-click the file, and then click Properties.
    2. On the Security tab, click Advanced.
    3. Ensure that the Owner is your user account.
    4. Click Disable Inheritance, and then select Convert inherited permissions into explicit permissions on this object.
    5. Select each permission entry that is not your user account and click Remove.
    6. Ensure that the access permission for your user account is Full control.
    7. Save your changes.
  2. To connect to the instance, open Windows PowerShell and run the following command:

    $ ssh –i <private_key> <username>@<public-ip-address>

    <private_key> is the full path and name of the file that contains the private key associated with the instance you want to access.

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

    <public-ip-address> is your instance IP address that you retrieved from the Console.

To connect to a Linux instance from a Windows system using PuTTY
  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 CentOS images, the default username is opc. For Ubuntu images, the default username is ubuntu.

      <public-ip-address> is your instance 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 drop-down list, 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, and then click Auth.

  6. Click Browse, and then select your private key.

  7. Click Open to start the session.

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

Running Administrative Tasks on the Instance

When you’re logged in as the default user, opc, you can use the sudo command to run administrative tasks.

What's Next

Now that you've got an instance and have successfully connected to it, consider the following next steps: