SSH certificate login fails with `error: Certificate invalid: name is not a listed principal`.
AdvancedTroubleshootingSSH, sudo and authentication
Answer
Likely causes → The certificate's principals don't include the target username or any principal in AuthorizedPrincipalsFile.
Diagnose →
ssh-keygen -L -f ~/.ssh/id_ed25519-cert.pub # Principals, Valid
grep -E 'TrustedUserCAKeys|AuthorizedPrincipals' /etc/ssh/sshd_config
cat /etc/ssh/auth_principals/deploy 2>/dev/null
Fix → Reissue the certificate with the right principal (ssh-keygen -s ca -I alice -n deploy,alice -V +8h key.pub) or add the principal to the server's principals file.
Prevent → Map principals to roles centrally and test cert issuance in CI.
More on SSH, sudo and authentication
`ssh deploy@server01` fails with `deploy@server01: Permission denied (publickey).`BeginnerPermissions on `~/.ssh` are correct, but you still get `Permission denied (publickey)` and the server log says `Authentication refused: bad ownership or modes for directory /home/deploy`.IntermediateKey auth fails only on RHEL with SELinux enforcing; the server logs show nothing unusual about modes.IntermediateAfter upgrading the client to a new OpenSSH, connections to an old appliance fail with `no matching host key type found. Their offer: ssh-rsa,ssh-dss`.IntermediateA user's RSA key stopped working against a new server: the server log says `userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms`.IntermediateSSH login takes 20–30 seconds before the password or key prompt appears.Intermediate