nerdexam
CompTIA

XK0-005 · Question #123

A Linux systems administrator is setting up SSH access with PKI for several using their newly created RSA keys. Which of the following MOST securely achieves this task?

The correct answer is C. Use ssh-copy-id to copy each user's public key file to the respective system. The ssh-copy-id command securely copies a user's public key to a remote server's authorized_keys file, handling permissions and directory creation automatically.

Security

Question

A Linux systems administrator is setting up SSH access with PKI for several using their newly created RSA keys. Which of the following MOST securely achieves this task?

Options

  • AUse curl to copy each user's public key file to the respective system
  • BUse cp to copy each user's public key file to the respective system
  • CUse ssh-copy-id to copy each user's public key file to the respective system
  • DUse ssh-copy-id to copy each user's private key file to the respective system

How the community answered

(33 responses)
  • A
    9% (3)
  • B
    18% (6)
  • C
    70% (23)
  • D
    3% (1)

Why each option

The `ssh-copy-id` command securely copies a user's public key to a remote server's `authorized_keys` file, handling permissions and directory creation automatically.

AUse curl to copy each user's public key file to the respective system

Using `curl` to copy a public key is generally not secure for this purpose, as it may not handle permissions correctly and could expose the key during transfer if not used with HTTPS and proper authentication.

BUse cp to copy each user's public key file to the respective system

Using `cp` directly to copy a public key would require manual secure transfer (e.g., via `scp` or `sftp`) and then manual permission setting on the remote server, which is less secure and more error-prone than `ssh-copy-id`.

CUse ssh-copy-id to copy each user's public key file to the respective systemCorrect

The `ssh-copy-id` utility is specifically designed to securely copy a user's public key to the remote server's `~/.ssh/authorized_keys` file. It automatically creates the `.ssh` directory and sets correct permissions, ensuring the private key remains secure and is never exposed or transferred.

DUse ssh-copy-id to copy each user's private key file to the respective system

Copying a user's *private* key to a remote system is a severe security risk, as private keys should always remain exclusively on the user's local machine and never be shared or stored on public-facing servers.

Concept tested: Secure SSH key deployment using ssh-copy-id

Source: https://man7.org/linux/man-pages/man1/ssh-copy-id.1.html

Topics

#SSH#Public Key Authentication#Linux Security#ssh-copy-id

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice