Can I, and in that case how can I, change the password of an SSH identity file without having to generate a new key and setting up it all over again?
Asked
Active
Viewed 1,401 times
0
-
1possible duplicate of How do I change my private key passphrase? – Greg Hewgill Jun 10 '15 at 20:19
-
Yes, it does look like it is. Is there any policy about duplicates spanning different sub forums in the stackexchange network? – lindhe Jun 10 '15 at 20:34
-
1No, I don't think there is. I just added that link manually for the benefit of anybody searching here for a question similar to yours. – Greg Hewgill Jun 10 '15 at 20:35
-
possible duplicate of Shell Script for logging into a ssh server – Invoker Jun 10 '15 at 22:41
-
1@Invoker that's not a duplicate. This question is about changing the password for an existing key. The dupe you proposed is completely different. – terdon Jun 11 '15 at 00:54
1 Answers
2
Identity file = private key file? From the manual, (man ssh-keygen
):
ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
The -p
switch changes the passphrase of a private key file with a prompt, whereas the -P
switch specifies the old password on the command line. Use one of these in interactive mode depending on the encryption algorithm and file name you have used.
ssh-keygen -p -f ~/.ssh/id_dsa
ssh-keygen -p -f ~/.ssh/id_rsa

Christopher
- 15,911