Use an SSH Serial Console connection to connect to the Console of an OCI instance - Kevinm-Oracle/Support_Knowlege GitHub Wiki

TLDR - Connect to an Linux instance hosted on Oracle OCI with a SSH Serial connect

Connecting to the Instance Console

You have an instance hosted on OCI and you need to connect to it via a serial connection, and you've received an error such as some of the following:
  • ssh_exchange_identification: Connection closed by remote host
  • Permission denied (publickey).

There are two Serial Connection options; one an SSH connection and two a VNC connection. This topic covers the SSH connection from a Linux instance / MAC in my case. For the purpose of writing this, I created a fresh instance called Happy_Public.

Step 1. Open your Happy instance and click Create Console Connection.

If you don't already have a key pair you'll need to generate one. In a bash shell run SSH-KEYGEN to generate public and private key pair files. In the following image, I generate the key by running ssh-keygen from the /.ssh folder under my user folder. The only input I'm providing is a file name and a key phrase. You can see there are two files generated in the folder. HappyKey the private key, and HappyKey.pub the public key. Drag the public key file into the cert box of the Create Console Connection box and click Create Console Connection.

Click on the three dots next to your console connection and select Connect with SSH. For me, I'm on MAC, so I select Linux/MAC OS. You could use this same command on Windows if you download and install Ubuntu from the Microsoft store, or you the enable the Linux for Windows bash console. Click the Copy button to copy the connection string.

The string you copy will not work by default. You have to modify the string with the proper path to your private key. To present the key from a file you have use -i option for the SSH command to present the key from a file. You need to add a -i in two places. Below you can see what you get, vs. what it looks like after you've added the -i and fixed the command.

ssh -o ProxyCommand='ssh -W %h:%p -p 443 ocid1.instanceconsoleconnection.oc1.eu-frankfurt-1.abtheljrqv7ik67grjhndbli35hokibguij6ui72uk26lbaryisthk6h5rwa@instance-console.eu-frankfurt-1.oraclecloud.com' ocid1.instance.oc1.eu-frankfurt-1.abtheljrgiyd4ccauxi2iybpq7b7uolaergswsfa3dcexwqn5jb62bpqlkvq

ssh -i ./.ssh/HappyKey -o ProxyCommand='ssh -W %h:%p -p 443 -i ./.ssh/HappyKey ocid1.instanceconsoleconnection.oc1.eu-frankfurt-1.abtheljrqv7ik67grjhndbli35hokibguij6ui72uk26lbaryisthk6h5rwa@instance-console.eu-frankfurt-1.oraclecloud.com' ocid1.instance.oc1.eu-frankfurt-1.abtheljrgiyd4ccauxi2iybpq7b7uolaergswsfa3dcexwqn5jb62bpqlkvq

Next Step. Take the fixed SSH string above and paste it into a console window.

I've used this key before so it did not ask me for the passphrase in the screen capture. The first time you use the key you'll need to enter the passphrase. You'll also not see the login prompt until you hit enter a few times to get the attention of the console. Now we have a console connection where we could login with the OPC default user account. If only we knew the password.

If you do not know the password - see the following for instructions to reset the password Resetting the OPC user password via the console

⚠️ **GitHub.com Fallback** ⚠️