SSH key authentication is not working
Environment
- Red Hat Enterprise Linux
Issue
- On our RHEL server ssh key authentication is not working. Why?
Resolution
- Once the public key is copied to the correct file (
/root/.ssh/authorized_keys.root
in the case of theroot
user), ssh key based authentication works again.
Root Cause
- On this specific system in
/etc/ssh/sshd_config
theAuthorizedKeysFiles
parameter was changed from the default value to:
AuthorizedKeysFile .ssh/authorized_keys.%u
- This change makes sshd look in a different file based on the username.
Diagnostic Steps
- Verify that the public key authentication is not working via
ssh -vvv <username>@hostname
and then verify the/etc/ssh/sshd_config
file on the host being accessed.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments