How to reset password from opc user from console connection

(I had to do this as my servers were not connecting via putty and original ppk keys. Hence I wanted to check if it is a server issue or network issue apart from the fact tracert to the servers were timing out all throughout)

First create a OCI serial console connection

  1. Open your OCI Dashboard Using your Web Browser.
  2. Open the Cloud Menu (Hamburger Icon –  ) and select “Compute”.
  3. On the “Instances” list Select the instance you would like to connect o using “Serial connection”.
  4. Scroll down and Select the “Console Connections” option.
  5. Press the “Create local connection” button.
  6. On the Popup window, Click on “Generate a keypair for me” and save public and private keys on your local PC.
  7. In few mins, you will see an active console connection.

Now connect using SSH

8. Copy the Console connection string (according to your desired method – SSH / VNC).

9. Open your Terminal / SSH Client and Paste the copied command. I used windows command prompt


Don’t forget the -i switch. it is very important, especially if your SSH keys is stored on a different location or if it is a specific key you generated for this scenario.

The correct syntax will be to add the -i after the ssh word and add the path to your key file, afterwords the rest of the command will remain on it’s original form.

Note: When using single quotes with ProxyCommand=, I got Bad stdio forwarding specification ‘%h:%p’

C:\Users\heema>ssh -i ssh-key-2022-11-29.key -o ProxyCommand=’ssh -i ssh-key-2022-11-29.key -W %h:%p -p 443” ocid1.instance.oc1.phx.anyhqljtxqk2jiacggemi6p7xgy4auhfgbmszhuq4li3ksi52yinh25edn5qC:\Users\heema>ssh -i ssh-key-2022-11-29.key -o ProxyCommand=”ssh -i ssh-key-2022-11-29.key -W %h:%p -p 443’ ocid1.instance.oc1.phx.anyhqljtxqk2jiacggemi6p7xgy4auhfgbmszhuq4li3ksi52yinh25edn5q
Bad stdio forwarding specification ‘%h:%p’


Solution was to use double quotes as below

C:\Users\heema>ssh -i ssh-key-2022-11-29.key -o ProxyCommand=”ssh -i ssh-key-2022-11-29.key -W %h:%p -p 443” ocid1.instance.oc1.phx.anyhqljtxqk2jiacggemi6p7xgy4auhfgbmszhuq4li3ksi52yinh25edn5q

Now we are connected to the server and it will ask for username/password. Since we dont have ‘opc’ password, we will follow below steps to create a new password

With your open console connection, you want to go back to the webpage where you built the console connection and reboot your instance, by clicking on the Reboot button.
Once you click Reboot go back to the terminal window and click on it to make it the active application. You’ll see the Linux stop and reboot routine scroll past the console eventually you’ll see the GRUB menu – From the GRUB menu take the following steps:

  1. As soon as you see the GRUB boot menu, use the up/down arrows to stop the process, enabling you to use the boot menu.
  2. In the boot menu, highlight the top item in the menu, and press e to edit the boot entry.
  3. In edit mode, scroll down until you reach the line that starts with either linuxefi and add the following to the line: init=/bin/bash

4. You don’t need to save the file. Reboot the instance using keyboard shortcut CTRL+X

5. After the instance has rebooted, you’ll see the Bash prompt – Now you have cosmic powers to the instance, play safe and only do what you understand. Maybe even take a snapshot before if you care about the instance.

6. Run the following command to load the Linux policies to preserve the files you’re about to modify: /usr/sbin/load_policy -i  //NOTE// If you skip this step you will not able to login to your instance via SSH or console and you’ll be sad.

7. The following command will remount the root partition into read and write mode so you can modify the password files : /bin/mount -o remount, rw /

8. The following command will reset the password of the OPC default user account: sudo passwd opc

9. After the password has been reset you’re done. Reboot the machine with the following command : sudo reboot -f

Now you’ve done all of the needful and you should be to login to your Linux instance from the console after the reboot.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s