Recovering opc user SSH Key - OCI
Recovering opc user SSH Key on OCI
=====================================
Today i came across the situation where my colleague has created UNIX instance on oci and then she lost opc user private keys. Due to that she was not able to login to that instance and no one has access to this instance as well. It can happen with any one who is trying to connect into their Oracle Cloud Infrastructure instance but either you forgot which key you used or, for some unknown reason, your opc user SSH key got corrupted or deleted. It might be scary at first, but the process to recover an opc user SSH key on Oracle Cloud Infrastructure is easy.
So if you get a "Permission denied (publickey,gssapi-keyex,gssapi-with-mic)" error when trying to connect via SSH, follow this process to recover your key.
Summary ( High Level Steps
- Stop the instance that you can't log in to.
- Detach the boot volume.
- Attach the boot volume to a running Linux instance.
- Run the iSCSI commands to attach the device and make it visible to the local operating system.
- Fix the authorized_keys file.
- Unmount the device and detach it by running the iSCSI commands.
- Attach the boot volume to the original instance and start it.
Process
- Stop the instance that you can’t connect to (Server 2 - OPC User Keys Lost, AD 2). In the Oracle Cloud Infrastructure Console, go to the details page for the instance and click Stop.
2. Detach the boot volume. In the Boot Volume section, click the Actions icon and choose Detach.
Go back to detach boot volume and get OCID.
I purposely tried to show this limitation. You can not attach Block Volume across different AD. Both boot volume should be in same AD group.
I have another instance in availability domain 2 . let's use that and move further.
Now you can see drop down list is showing AD 2 volume automatically . chose it.
Click Attach.
4. After the boot volume attachment is completed (the BV icon is green), connect through SSH in the running VM and run the iSCSI commands to make that new disk available and visible by the OS.
Your boot-volume should appear as /dev/sdb.
$ sudo mount -o nouuid /dev/sdb3 /mnt
$ sudo vi /mnt/home/opc/.ssh/authorized_keys
After you add or change the SSH public key you need to use, save and exit it.
Run umount /mnt.
$ sudo umount /mnt
9. Reattach the boot volume to the instance where you wanted to recover the SSH key, wait for it to become operational (green icon) and start it.
Lets try to connect to this server using new keys.
We recovered our opc user SSH key and we can now log back into the instance. We can also use this process for troubleshooting the root (/) partition.
This whole process will take 20 minutes ..
Happy Learning.
How do i create a /dev/sdb3 partitions???
ReplyDeleteRecovering Opc User Ssh Key - Oci >>>>> Download Now
ReplyDelete>>>>> Download Full
Recovering Opc User Ssh Key - Oci >>>>> Download LINK
>>>>> Download Now
Recovering Opc User Ssh Key - Oci >>>>> Download Full
>>>>> Download LINK oT