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.rootin the case of therootuser), ssh key based authentication works again.
Root Cause
- On this specific system in
/etc/ssh/sshd_configtheAuthorizedKeysFilesparameter 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>@hostnameand then verify the/etc/ssh/sshd_configfile 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.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
