Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've got a whole pile of SSH keys here, public and private. How do I find out which private keys require a password, and which don't?

share|improve this question

2 Answers 2

up vote 8 down vote accepted

Assuming you're talking about OpenSSH format keys:

$ grep ENCRYPTED *id*
test2.id:Proc-Type: 4,ENCRYPTED
id_dsa:Proc-Type: 4,ENCRYPTED

It's simpler than you might expect :)

$ head test.id
-----BEGIN RSA PRIVATE KEY-----
MIIEoAIBAAKCAQEAogi+ ...

$ head test2.id
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
...
share|improve this answer

Encrypted private keys will contain the line:

Proc-Type: 4,ENCRYPTED
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.