What's the password of an SSH private key?
I've never seen this window when doing ssh over the terminal, but now I'm using a python script that does ssh over the paramiko
python module and I'm asked to provide a password (that I don't remember setting) in order to unlock the private key username@hostname
. I tried my root password but it won't work.
The entire window says:
Enter password to unlock the private key
An application wants access to the private key
'user@host'
, but it's locked
What is this password? I've never needed it.
This is your SSH private key's password.
When you created your SSH key, you may have been queried to enter a password used to encrypt it and keep it secure.
Usually, when you SSH into a server using this private key, the SSH daemon retrieves the decryption password from your keychain, where it's usually stored. Because you're using something that doesn't directly use the SSH daemon, it's likely that it wants you to re-authenticate for security purposes.
If you don't remember your password, it will be stored in your system keychain. To read this, simply go into your "Passwords and Keys" program. From there, go to the login
keychain. Look for the entry for "Unlock Password for user@host". Your password will be there.
According to this SO Q&A - How to ssh connect through python Paramiko with public key
paramiko
uses OpenSSH format keys. and it expect to get encrypted key as input so you also need to decrypt the key first.
-
Here you can see how to use
putty
in order to convert your PGP key into OpenSSH key format:To create a valid DSA format private key supported by Paramiko in Puttygen. Click on Conversions then Export OpenSSH Key
Here you can find simple python script which uses the key and
paramiko
.
Enter the "pass phrase" that you entered when generating the key.