0

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?

lindhe
  • 4,096
  • 3
  • 20
  • 34
  • 1
    possible duplicate of [How do I change my private key passphrase?](https://serverfault.com/questions/50775/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
  • 1
    No, 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](http://unix.stackexchange.com/questions/31071/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 Answers1

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,611
  • 7
  • 51
  • 64