My Oracle Support Banner

Unable to Connect to System with valid SSH keys After Replacing authorized_keys File (Doc ID 2692858.1)

Last updated on MAY 30, 2023

Applies to:

Oracle Cloud Infrastructure - Version N/A and later
Linux x86-64

Symptoms

Attempts to login via ssh using a keypair result in the login process failing or falling back to password authentication if the option is enabled.

Password authentication works if enabled.

All file and directory permissions for the user and .ssh directory and files are correct.

Contents of ~/.ssh/authorized_keys file are correct.

sshd logs do not show any errors other that key-based authentication failing

ssh connection debug does not show any errors other than the ssh key authentication stopping from the SSH server side with failed authentication:

debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug2: key: /User/.ssh/id_rsa (0x7fa807c00440)
debug2: key: /User/.ssh/id_dsa (0x0)
debug2: key: /User/.ssh/id_ecdsa (0x0)
debug2: key: /User/.ssh/id_ed25519 (0x0)
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
Authentication failed.

 

 

Changes

 User opc ~/.ssh/authorized_keys file was previously deleted on the server and a new one created with a fresh ssh public key

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.