oracle-cloud-infrastructure

Oracle Cloud: Permission denied (publickey,gssapi-keyex,gssapi-with-mic)


I created an new Oracle cloud Linux instance, downloaded the private and public keys on creation, and now I cannot access it. I followed the guides and searched around, but I can mostly just find people who got their keys mixed up, which I have double-checked.

It shows as running, but if I try to SSH by doing:

ssh -i ssh-key-2022-09-18.key ops@xxx.xxx.xxx.xxx

Then I get:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Any help?


Solution

  • If you have used the OCI auto generated keys during Instance Creation then the default username is opc and not ops as mentioned in your question.

    You will only be able to connect via SSH only if the keys are not misplaced as there is no way to retrieve the private key after the instance is created.

    In case you have misplaced the keys then to upload new keys you will have to work with the boot volume (refer this answer How do you change the public key of a Oracle Cloud Instance? for more details on how to add new SSH key)

    Note: To access OCI Instance, there are many other prerequisites like having public IP or accessing via bastion, etc. Please review this https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/accessinginstance.htm document for more details.