Interview Prep/Linux/SSH, sudo and authentication

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.

All Linux questions Roadmap: Linux

More on SSH, sudo and authentication