I've had issues copying public keys to
authorized_keys and winding up with an extra linefeed or space or something.
Is there a way to simply validate that a key looks like a valid key? I don't have the private key.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
ssh-keygen -lf authorized_keys is enough.
ssh-keygen -lf authorized_keys key_read: uudecode AAAAB3Nzaf1a8eEABBABIwAAAQEA1y8gXks+s19QFdLP3ddei failed authorized_keys is not a public key file.
(You may copy the respective line to a separate file before checking.) If the hashing function is too stupid to detect errors then converting back and forth may do:
ssh-keygen -ef id_dsa.pub -m PKCS8 | ssh-keygen -i -f /dev/stdin -m PKCS8
I expect that pipeline to fail in case of formatting errors.