To add a passphrase when generating an SSH key, follow these steps:
-
Open your terminal.
-
Run the
ssh-keygencommand:ssh-keygen -t rsa -b 4096 -C "your_email@example.com" -
When prompted for the file location:
- Press Enter to accept the default location (e.g.,
~/.ssh/id_rsa).
- Press Enter to accept the default location (e.g.,
-
When prompted for a passphrase:
- Type your desired passphrase. This passphrase will be used to encrypt your private key.
- Press Enter.
-
When prompted to confirm the passphrase:
- Type the same passphrase again and press Enter.
After completing these steps, your SSH key will be generated with a passphrase. You will need to enter this passphrase each time you use the private key for SSH connections.
