You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

OCI: SSH Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

edited Aug 9, 2022 4:44PM in Linux 3 comments

Applies to: 

Oracle Cloud Infrastructure

SYMPTOMS

Keys generated using puttygen in .ppk format will result in following error when tried with -i option ssh command line: 

[opc@<HOST> ~]$ ssh -i deployment_key.txt opc@<IP_ADDRESS>
Enter passphrase for key 'deployment_key.txt':
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
[opc@<HOST> ~]$

CAUSE

PuTTY, ssh.com and OpenSSH have different file formats.

With ssh-keygen the file format is like this:

$ cat /home/opc/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAly5OY7zsxkT/OyVQnkJ+9KXokNheY+9TC+QHR2526PFJo9nr
<KEY_CONTENT>
GFwyombkOkaljBWGTofG8fX6l2Ysaw0QFhdx8Ku/TB5Fk55arKZwbw==
-----END RSA PRIVATE KEY-----
The Puttygen file format is:
PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: rsa-key-20190520
Public-Lines: 6
AAAAB3NzaC1yc2EAAAABJQAAAQEAoLzyYW4nsSezjEfg7EGb7LvJfq5HpjfyuqUM
KYQZqbJWyO7e8Dw5oC52RfQoBDyjcn9inZUMlhqxCr07HLihg/FFo9o3Udo3zB8w
WdwQt8lUYU/NJpG7WxSxCwOx82bmNwtERutV9BsNzbzq81IBbTT5ntKb4NSPdrXR
79zhjTOVvCRMJ+1heqhVP4OpNCM9IdMIW9Ci9o8T3S5hLkDo7CXxX/X8O2tDVatd
6SHt2u4CuP5oOoyE0ZybRchjfOOt//jzOxjmEl4gj+XBc4AVqm6ps/YawLhkxULX
xf1SQLXpVVhcaLlh9TLW8rmHiaOpIQbohkvx6CupDNZesnYbAw==
Private-Lines: 14
AAABAFKKik21G00iOZsQJ2SQZNODBpr/jJOgMIlbrEyrnnm8ccEgt6vL5j1/pITJ
<KEY_CONTENT>
ls498RvIbn5Lu1aNWIG4uXwkhUhMpSjHcFA57LzjMxrvCA==
Private-MAC: 9a3985db41e60f4c36986cc61e831c1b6af382f5
ssh.com format:
---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----
Comment: "rsa-key-20190520"
P2/56wAAA+wAAAA3aWYtbW9kbntzaWdue3JzYS1wa2NzMS1zaGExfSxlbmNyeXB0e3JzYS
<KEY_CONTENT>
acMKEgfHufanm/dTKehos3F8c8nUE3FVY/RqXrj8XcLGn0+06djwBhWQiiFIPv4odGbHSm
jdjR41knM=
---- END SSH2 ENCRYPTED PRIVATE KEY ----

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!