XK0-006 Security Practice Question
Which command can be used to generate an SSH key pair for user authentication?
⚠ Common exam trap
It's easy for candidates to confuse `ssh-keygen` (key generation) with `ssh-copy-id` (key deployment) or `ssh-add` (key loading), leading them to pick a command that manages existing keys rather than creating new ones.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
ssh-keygen
The `ssh-keygen` command is the standard tool for generating SSH key pairs (public and private keys) used for user authentication. It creates RSA, ECDSA, Ed25519, or DSA key files (e.g., `~/.ssh/id_rsa` and `~/.ssh/id_rsa.pub`) and supports options like `-t` for key type and `-b` for bit length, directly enabling passwordless login via public key authentication.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
ssh-keyscan
Why it's wrong here
ssh-keyscan collects public host keys from remote SSH servers to populate a known_hosts file; it never creates a key pair. It is tempting because its name suggests key handling, and it would be the right tool for verifying or gathering a server's host key fingerprint during first connection.
- ✓
ssh-keygen
Why this is correct
`ssh-keygen` generates an asymmetric key pair — a private key plus a matching public key — for public-key authentication, satisfying the stem's requirement to create an SSH key pair. It writes them to `~/.ssh/id_rsa` and `id_rsa.pub` by default, and the public half is then copied to the remote host's `authorized_keys`.
- ✗
ssh-copy-id
Why it's wrong here
ssh-copy-id installs an already-generated public key into a remote account's authorized_keys file; it does not create the key pair itself. It is tempting because it is part of the key-based login workflow, and it would be correct for distributing an existing public key to a target host.
- ✗
ssh-add
Why it's wrong here
ssh-add loads an existing private key into the ssh-agent for session use; it cannot create a key pair. It is tempting because it handles SSH authentication keys, but that is post-generation key management. Generating a pair requires ssh-keygen, which writes the public and private key files.
Quick reference
Asymmetric Encryption Algorithm Comparison
| Algorithm | Key Exchange | Signatures | Equivalent Security Key | Notes |
|---|---|---|---|---|
| RSA-3072 | Yes | Yes | 128-bit | Widely deployed; slow for bulk data |
| ECDSA P-256 | No | Yes | 128-bit | Fast signatures; standard TLS certs |
| ECDH / ECDHE | Yes | No | 128-bit | Perfect forward secrecy in TLS 1.3 |
| DH / DHE | Yes | No | 128-bit (3072-bit key) | Replaced by ECDHE in modern TLS |
| Ed25519 | No | Yes | ~128-bit | SSH keys, modern PKI |
Go deeper
Related to this question
Learn chapter
User and Group Administration
Key term
User
A user is any person, system, or device that interacts with an IT service, resource, or identity system, typically authenticated through credentials and authorized to perform specific actions.
Key term
SSH
SSH (Secure Shell) is a cryptographic network protocol that provides secure, encrypted communication and remote administration between two devices over an unsecured network.
About these practice questions
One of 781 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.