You have the option to whether assign a passphrase or not when creating your SSH private and pubic key pair.

This can be changed after the fact as you can perform the following operations on your existing SSH private key using ssh-keygen:

How to add passphrase to an SSH key

  1. Run ssh-keygen with -p option .
    $ ssh-keygen -p 
  2. Specify the location of your SSH private key.
    Enter file in which the key is (/home/user/.ssh/id_rsa):

    Default location is selected by default

  3. Comment of the private key will be displayed.
    Key has comment 'user@host'
  4. Enter a passphrase for the key twice.
    Enter new passphrase (empty for no passphrase):
    Enter same passphrase again:
  5. Confirmation message will be displayed.
    Your identification has been saved with the new passphrase.

How to edit passphrase of an SSH key

  1. Run ssh-keygen with -p option .
    $ ssh-keygen -p 
  2. Specify the location of your SSH private key.
    Enter file in which the key is (/home/user/.ssh/id_rsa):

    Default location is selected by default

  3. Enter existing passphrase for the private key.
    Enter old passphrase:
  4. Comment of the private key will be displayed.
    Key has comment 'user@host'
  5. Enter a passphrase for the key twice.
    Enter new passphrase (empty for no passphrase):
    Enter same passphrase again:
  6. Confirmation message will be displayed.
    Your identification has been saved with the new passphrase.

How to remove passphrase from an SSH key

  1. Run ssh-keygen with -p option .
    $ ssh-keygen -p 
  2. Specify the location of your SSH private key.
    Enter file in which the key is (/home/user/.ssh/id_rsa):

    Default location is selected by default

  3. Enter existing passphrase for the private key.
    Enter old passphrase:
  4. Comment of the private key will be displayed.
    Key has comment 'user@host'
  5. Press Enter twice without entering any passphrase.
    Enter new passphrase (empty for no passphrase):
    Enter same passphrase again:
  6. Confirmation message will be displayed.
    Your identification has been saved with the new passphrase.
Discuss the article:

Share your thoughts, suggest corrections or just say Hi. Login not required.

Share!