Naming your SSH key is important for organization and easy identification. By default, SSH keys follow a naming convention, but you have flexibility to choose more descriptive names.
Default Naming Convention
According to default settings, SSH keys are typically named using the following structure:
- A prefix of
"id_"
- Followed by the key type (e.g.,
"rsa"
,"dsa"
,"ed25519"
) - The public key has a
".pub"
suffix
For example, a common SSH key pair is named id_rsa
(private key) and id_rsa.pub
(public key). (Reference: 02-Feb-2023).
Custom Naming
While the default naming convention is useful, you can choose custom names that reflect the purpose or context of the key. This can be helpful for managing multiple keys. Here’s how:
- Descriptive Names: Use names that indicate the server, application, or user the key is associated with. For example,
github_deploy_key
orserver1_admin
. - Consistency: Maintain a consistent naming scheme across all your keys for easier management.
- Avoid Spaces: Do not include spaces in your filenames. Use underscores or hyphens instead.
- Example: Instead of
id_rsa
, you could name your keysprojectx_rsa
andprojectx_rsa.pub
.
Examples
Here are some example SSH key names you might use:
webserver_admin
andwebserver_admin.pub
database_backup
anddatabase_backup.pub
gitlab_deploy
andgitlab_deploy.pub
Table of Key Naming Examples
Purpose | Private Key Name | Public Key Name |
---|---|---|
Default RSA Key | id_rsa |
id_rsa.pub |
Key for Web Server | webserver_key |
webserver_key.pub |
Key for Database | database_key |
database_key.pub |
Deployment Key | deploy_key |
deploy_key.pub |
Personal GitHub Key | github_personal |
github_personal.pub |
By following these guidelines, you can create a naming system that makes your SSH keys easier to manage and understand.