VMware ESXi and vSphere Cluster Management
Understanding the id_ecdsa SSH Key File
Learn what id_ecdsa is, how ECDSA SSH authentication works, and how to create, install, select, protect, inspect, rotate, and troubleshoot the key.
id_ecdsa is the conventional OpenSSH filename for an ECDSA private key. Its matching public key is normally stored as ~/.ssh/id_ecdsa.pub. Together, these files let an SSH client prove your identity to a remote server without sending the private key to that server.
This lesson covers key creation, server installation, Git and service configuration, permissions, agents, algorithm compatibility, inspection, rotation, and troubleshooting.
What id_ecdsa Means
ECDSA means Elliptic Curve Digital Signature Algorithm. In OpenSSH, id_ecdsa is the conventional name for an ECDSA private key, while id_ecdsa.pub is the corresponding public key.
The private key is a secret credential kept on your local computer. The public key is non-secret key material that can be installed on remote servers, Git hosting accounts, or other SSH-based services. The two keys are mathematically related, but the public key does not reveal the private key.
| File or location | Typical purpose | Secret or shareable | Typical permissions |
|---|---|---|---|
~/.ssh/id_ecdsa | ECDSA private identity used by the SSH client | Secret; never share | 600 |
~/.ssh/id_ecdsa.pub | Public counterpart used to authorize the private key | Shareable | 644 |
~/.ssh/authorized_keys | Public keys authorized for a remote account | Shareable, but protect from unauthorized modification | Often 600 |
~/.ssh/config | Local SSH client settings, including IdentityFile | Usually not secret, but protect it from unwanted changes | Often 600 or 644 |
~/.ssh | Typical directory for SSH keys and configuration | Directory contents vary; protect access | 700 |
These are user authentication keys. They are different from SSH host keys, which identify the server to clients and are commonly stored under a server's system SSH directory. Your id_ecdsa file identifies you to a server; it does not identify the server to you.
How ECDSA SSH Authentication Works
Public-key authentication uses a key pair. The private key creates a digital signature, and the public key verifies that signature. A signature proves possession of the private key without disclosing it.
- The SSH client connects to a server and identifies a public-key identity it might use.
- The server checks whether that public key appears in the target account's
~/.ssh/authorized_keysfile. - If the key is authorized, the server sends or participates in an authentication challenge.
- The client signs authentication data with the local private key, such as
~/.ssh/id_ecdsa. - The server verifies the signature with the authorized public key. If verification succeeds, authentication is accepted.
The private key stays on the client throughout this process. You can copy id_ecdsa.pub to a server or paste its public-key text into a code-hosting service, but you must not copy id_ecdsa.
Default Locations and Identity Selection
On Linux and macOS, the tilde character represents your home directory. The typical SSH directory is ~/.ssh. It is hidden because its name begins with a dot.
~/.ssh/id_ecdsa # private ECDSA key
~/.ssh/id_ecdsa.pub # public ECDSA key
When no key is explicitly selected, OpenSSH considers several conventional identity filenames, including id_ecdsa. Exact behavior can be influenced by the SSH version, configuration, agent state, and server policy.
You can use a custom filename for a second identity, such as ~/.ssh/id_ecdsa_work. Custom names prevent one key-generation command from overwriting another and make separate personal, work, or deployment identities easier to manage.
Generating an ECDSA Key Pair
The ssh-keygen command creates and inspects SSH keys. This command creates an ECDSA key using the conventional default path:
ssh-keygen -t ecdsa -b 521 -C "user@example.com"
-t ecdsaselects the ECDSA algorithm.-b 521requests a curve size where supported. For ECDSA, common sizes correspond to NIST curves such asnistp256,nistp384, andnistp521.-Cadds a descriptive comment. The comment helps identify a key and is not used as the secret credential.
The command asks for a file in which to save the key. Press Enter to accept the default path, or enter a custom path. It then asks for a passphrase. A strong, memorable passphrase encrypts the private key when it is stored on disk.
Finally, ssh-keygen normally prints the private-key path, public-key path, key fingerprint, and a randomart image. A fingerprint is a short hash-based identifier that helps you recognize a key without comparing its entire contents.
For a separate work identity, choose a path that does not already contain a key:
ssh-keygen -t ecdsa -b 521 -f ~/.ssh/id_ecdsa_work -C "work@example.com"
If the selected filename already exists, stop and verify its contents before continuing. Do not approve an overwrite unless you intentionally want to replace that key and have already planned its rotation.
Installing the Public Key
Using ssh-copy-id
On systems that provide ssh-copy-id, use it to append the public key to the remote account:
ssh-copy-id -i ~/.ssh/id_ecdsa.pub user@server.example
The command usually logs in using an existing password or another available method, then installs the public key in the remote user's ~/.ssh/authorized_keys file. Test the result explicitly:
ssh -i ~/.ssh/id_ecdsa user@server.example
Manual installation
When ssh-copy-id is unavailable, display the public key and copy its complete single line:
cat ~/.ssh/id_ecdsa.pub
Using an already working login method, create the remote directory and append the line:
mkdir -p ~/.ssh
chmod 700 ~/.ssh
cat >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
Paste the full public-key line when cat is waiting for input, then press Enter and finish with the end-of-file keystroke for your shell. Ensure the line is not wrapped into multiple lines and that the file is owned by the remote account.
Git hosting and other services
Git hosting services generally provide an account or repository setting for SSH keys. Copy only the contents of id_ecdsa.pub, including its key type, encoded key data, and optional comment. Never upload the private id_ecdsa file.
Selecting an ECDSA Key
One-time selection with ssh -i
The -i option chooses a private key for one connection:
ssh -i ~/.ssh/id_ecdsa user@server.example
This is useful for testing or for a one-off connection. It does not permanently change SSH behavior.
Persistent selection with IdentityFile
For repeated connections, add a host-specific block to ~/.ssh/config:
Host work-git
HostName github.com
User git
IdentityFile ~/.ssh/id_ecdsa_work
IdentitiesOnly yes
With this configuration, connect using the alias:
ssh work-git
IdentityFile specifies the private-key path. IdentitiesOnly yes tells the client to use the configured identities rather than trying many unrelated agent or default identities. This is especially useful when personal and work keys are loaded at the same time.
Using ssh-agent
ssh-agent is a process that holds unlocked private keys for a session. It lets the SSH client use a passphrase-protected key without asking for the passphrase on every connection.
ssh-add ~/.ssh/id_ecdsa
ssh-add -l
ssh-add loads the key and prompts for its passphrase. ssh-add -l lists fingerprints of keys currently loaded in the agent. If the intended ECDSA key is absent, add it or correct the agent environment used by the current shell.
Permissions and Private-Key Protection
OpenSSH checks private-key permissions because another local user who can read the file can impersonate you. It may reject a key that is accessible to group or other users.
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ecdsa
chmod 644 ~/.ssh/id_ecdsa.pub
chmod 600 ~/.ssh/authorized_keys
chmod 600 ~/.ssh/config
The private key should be owned by your account. The remote ~/.ssh directory and authorized_keys file should also normally be owned by the remote account. Exact modes can vary by operating system and server policy, but private keys should remain readable only by their owner.
Never email id_ecdsa, commit it to source control, paste it into a ticket, or upload it to a service. If a private key may have been exposed, treat it as compromised even if it has a passphrase. A passphrase limits offline use of a stolen file, while an agent reduces repeated handling of the unlocked key.
ECDSA Curves and Algorithm Choice
ECDSA SSH keys may use NIST curves including nistp256, nistp384, and nistp521. Whether a particular key works depends on the SSH client, server version, configured security policy, and destination service.
| Algorithm | Typical modern use | Compatibility considerations | Key-management note |
|---|---|---|---|
| ECDSA | Existing SSH identities and environments that support its curves | Requires compatible client, server, and policy support for the selected curve and signature algorithm | An existing id_ecdsa can continue to be used when accepted |
| Ed25519 | Commonly preferred modern SSH choice when supported | Some older clients, servers, embedded systems, or organizational policies may not support it | Generate a new key pair; do not convert an ECDSA private key |
| RSA | Legacy compatibility and systems with RSA-specific requirements | Modern servers may require sufficiently large keys and approved RSA signature algorithms | Use current policy-approved settings rather than old defaults |
ECDSA is not converted into Ed25519 or RSA. Changing algorithm type requires generating a new key pair, installing the new public key, testing it, and then retiring the old authorization.
Inspecting and Validating Keys
Derive a missing public key
If id_ecdsa.pub was deleted but the private key still exists, recreate the public-key text from the private key:
ssh-keygen -y -f ~/.ssh/id_ecdsa > ~/.ssh/id_ecdsa.pub
This does not create a new identity. It derives the matching public key from the existing private key. Protect the private key while running the command and verify the resulting public key before distributing it.
Display a fingerprint
ssh-keygen -lf ~/.ssh/id_ecdsa.pub
Compare this fingerprint with a fingerprint shown by a hosting service, administrator, or trusted configuration. A fingerprint is useful when the full public-key line is inconvenient to compare.
Verify that two files match
Derive a temporary public key from the private key and compare it with the stored public key:
tmp=$(mktemp)
ssh-keygen -y -f ~/.ssh/id_ecdsa > "$tmp"
ssh-keygen -lf "$tmp"
ssh-keygen -lf ~/.ssh/id_ecdsa.pub
rm -f "$tmp"
The fingerprints should match. This verifies correspondence without exposing the private key's contents.
Safe Key Rotation
Rotation replaces an identity in a controlled sequence. It is required when a private key may have been exposed and is also useful for planned credential maintenance.
- Generate a replacement key with a new filename and a strong passphrase.
- Install only the replacement public key on every required server or service.
- Test the replacement using
ssh -ior a temporaryIdentityFilesetting. - Confirm that all required accounts, automation jobs, and Git services work.
- Remove the old public key from remote
authorized_keysfiles and service settings. - Remove the old private key from agents and local storage when it is no longer needed.
If exposure is suspected, rotate promptly, review where the key was used, inspect relevant logs, and remove the old authorization. Changing only the passphrase does not change the underlying key and does not invalidate copies of the old private key.
Common id_ecdsa Problems
| Symptom or message | Likely cause | How to verify | Resolution |
|---|---|---|---|
Permission denied (publickey) | Missing public key, wrong username, wrong host, or wrong identity | Use ssh -vvv; inspect remote authorized_keys and server logs if available | Install the matching public key, correct the account or host, or select the intended identity |
| Unprotected private key file | Private key is readable by group or other users, or has incorrect ownership | Inspect with ls -l ~/.ssh/id_ecdsa and check filesystem permission support | Use owner-only permissions such as chmod 600 and correct ownership |
| Wrong key offered | Another default key, agent identity, or configuration block is being used | Review ssh -vvv, ssh-add -l, and matching Host blocks | Use -i, configure IdentityFile, and consider IdentitiesOnly yes |
| Server does not accept the algorithm | Server policy, client age, or destination service rejects ECDSA | Check verbose negotiation messages and supported algorithm policy | Generate and install a new key type approved by the server, then configure that identity |
Public key not found in authorized_keys | Wrong file, malformed line, wrong remote account, or incorrect ownership | Compare public-key fingerprints and inspect remote path and permissions | Install the complete matching public-key line and correct remote ownership and modes |
Using ssh -vvv to Diagnose Connections
Verbose mode shows how the client selects and offers identities:
ssh -vvv -i ~/.ssh/id_ecdsa user@server.example
Look for lines that identify the configuration files read, key files loaded, identities offered, and the server's response. The output can reveal that the client never read the expected key, offered a different key, was refused by the server, or reached a server-side algorithm restriction.
For Permission denied (publickey), verify the destination hostname and username first. Then confirm that the complete public-key line is in the correct remote account's authorized_keys. If the key is present, check local selection, agent contents, local permissions, remote ownership, and server logs.
Automation Considerations
Interactive login may work while automation fails because the automated process has a different home directory, no SSH agent, no access to the key, or no way to answer a passphrase prompt. Check the configured key path, ownership, permissions, agent environment, and destination account.
Use a dedicated, appropriately protected deployment identity when appropriate, restrict its remote permissions, and configure the key explicitly. Do not solve automation failures by making a private key world-readable or disabling essential host verification.
Exam-Relevant Notes
id_ecdsais the private key;id_ecdsa.pubis its public counterpart.- The private key remains on the client and signs authentication data; the server verifies with the public key.
authorized_keyscontains public keys authorized for a remote account.ssh-keygencreates and inspects keys;ssh-addmanages identities inssh-agent.-iselects a key for one connection;IdentityFileselects one persistently for a configured host.- Private keys need restrictive permissions, commonly mode
600;~/.sshcommonly uses mode700. - Ed25519 is commonly preferred when supported, but compatibility and policy determine the correct algorithm.
- ECDSA keys cannot be converted into Ed25519 or RSA keys; generate a new pair instead.
- For rotation, install and test the replacement public key before removing the old authorization.
Quick Reference
# Generate the default-named key
ssh-keygen -t ecdsa -b 521 -C "user@example.com"
# Generate a separate work key
ssh-keygen -t ecdsa -b 521 -f ~/.ssh/id_ecdsa_work -C "work@example.com"
# Install the public key
ssh-copy-id -i ~/.ssh/id_ecdsa.pub user@server.example
# Use a specific key
ssh -i ~/.ssh/id_ecdsa user@server.example
# Load and inspect agent identities
ssh-add ~/.ssh/id_ecdsa
ssh-add -l
# Show a fingerprint
ssh-keygen -lf ~/.ssh/id_ecdsa.pub
# Recreate the public key
ssh-keygen -y -f ~/.ssh/id_ecdsa > ~/.ssh/id_ecdsa.pub
# Debug authentication
ssh -vvv -i ~/.ssh/id_ecdsa user@server.example
For a focused reference, see id_ecdsa SSH key file.