> For the complete documentation index, see [llms.txt](https://pentest.mxhx.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pentest.mxhx.org/05-passwords-ciphers/05-crask-sshprivkey-passphrase.md).

# SSH PrivKey Passphrase

## ssh2john

* Private Keys Sometimes have a Passphrase.
* But they are crackable (if not too complicated)
* /usr/share/john/ssh2john.py
* /usr/share/JohnJumbo/run/ssh2john.py

```
Hash:
> python ssh2john.py id_rsa > sshkey
> python /usr/share/JohnJumbo/run/ssh2john.py davidkey.pem > sshkey

Crack:
> john sshkey
> john --wordlist=/opt/wordlist/rockyou.txt sshkey

Tried Hashcat, but Didn't work for me:
sudo hashcat --force -m 500 -a 0 -O sshkey /opt/wordlist/rockyou.txt


----------------------------
alternate:

python sshng2john.py idrsa > sshkey
john sshkey
```

REF: [Cracking/John](/05-passwords-ciphers/cracking.md#john), [SSHTips](/03-getting-in/03-ssh-tips.md)
