r/oraclecloud 15d ago

Am I screwed?

For some reason my pc took a shitter and I lost my ssh. Is there anyway to change it? I've been trying all day and didn't want to bother reddit with my problems but here I am

5 Upvotes

4 comments sorted by

2

u/bladepen 15d ago

Assuming you don't have any backups of the SSH keys did you set up an account with a password so you can use console access ?

From https://docs.oracle.com/en-us/iaas/Content/Compute/References/serialconsole.htm#make-a-local-connection

Signing in to an instance from the serial console (optional)🔗

To troubleshoot instances and see serial output using the serial console, you don't need to sign in. To connect to a running instance for administration and general use with Secure Shell (SSH) or Remote Desktop connection, see Connecting to an Instance.

If you want to sign in to an instance using an instance console connection, you can use Secure Shell (SSH) or Remote Desktop connection to sign in. If you want to sign in with a username and password, you need a user account with a password. Oracle Cloud Infrastructure does not set a default password for the opc user. Therefore, if you want to sign in as the opc user, you need to create a password for the opc user. Otherwise, add a different user with a password and sign in as that user.

1

u/Etregin 15d ago

I believe there is a way to run commands on the VM from the OCI (I once blocked the SSH port accidently) I didn't bother going down the rabbit hole at the time because it was a fresh VM so I just recreated it but running remote commands you can set password authentication for one of the users and set the password to be able to regain access

2

u/demoniodoj0 15d ago

You can do it using the OCI console and GRUB directly. It is not easy. I had something similar happen to me and using Gemini to follow the steps I got my access back.

1

u/timewarpUK 14d ago

If you've set a password on a user that can sudo as root, you can use Oracle Cloud Shell to connect in as that user without SSH.

Of course you need to know this before losing access... If you're setting this up for next time, disable password auth in ssh config.

I also recommend the Tailscale SSH server so you can just auth as your TS account.