Resetting the OPC user password via the console - Kevinm-Oracle/Support_Knowlege GitHub Wiki
TLDR - How to set the OPC user account of an Oracle Linux hosted in OCI.
By default, the OPC or UBUNTU user accounts created when you build an instance using an Oracle provided image have no password. If you need to login with a user account for any reason the following process will allow you set a password via GRUB To start open an SSH serial console connection to your instance. For help opening an instance see the following -Use an SSH Serial Console connection to connect to the Console of an OCI instance
With your serial console connection open, you want to open your instance in the OCI web management console and restart it, by clicking on the Reboot button. After 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:
- 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.
- In the boot menu, highlight the top item in the menu, and press e to edit the boot entry.
- 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
- You don't need to save the file. Reboot the instance using keyboard shortcut CTRL+X.
- 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.
- 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.
- 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 /
- The following command will reset the password of the OPC default user account: sudo passwd opc
- After the password has been reset you're done. Reboot the machine with the following command : sudo reboot -f