Public and private key pairs are used for publickey authentication method in SSH. When creating the SSH key pair for publickey authentication, you can assign a passphrase to the private key.
A private key without a passphrase would allow passwordless login to SSH servers, whereas if a passphrase is assigned, you'll need to key in the passphrase during the publickey login process.
You can manage the passphrase of your SSH key after you create the key pairs. You can add, edit or remove the passphrase on your existing SSH private key using ssh-keygen.
Methods to manage passphrase of an SSH key.
$ ssh-keygen -p
Enter file in which the key is (/home/user/.ssh/id_rsa):
Default location is selected by default
Key has comment 'user@host'
Enter new passphrase (empty for no passphrase): Enter same passphrase again:
Your identification has been saved with the new passphrase.
$ ssh-keygen -p
Enter file in which the key is (/home/user/.ssh/id_rsa):
Default location is selected by default
Enter old passphrase:
Key has comment 'user@host'
Enter new passphrase (empty for no passphrase): Enter same passphrase again:
Your identification has been saved with the new passphrase.
$ ssh-keygen -p
Enter file in which the key is (/home/user/.ssh/id_rsa):
Default location is selected by default
Enter old passphrase:
Key has comment 'user@host'
Enter new passphrase (empty for no passphrase): Enter same passphrase again:
Your identification has been saved with the new passphrase.
Comment anonymously. Login not required.