CompTIA Linux+ (XK0-005) — Question 103
A user generated a pair of private-public keys on a workstation. Which of the following commands will allow the user to upload the public key to a remote server and enable passwordless login?
Answer options
- A. scp ~/.ssh/id_rsa user@server:~/
- B. rsync ~ /.ssh/ user@server:~/
- C. ssh-add user server
- D. ssh-copy-id user@server
Correct answer: D
Explanation
The correct command is 'ssh-copy-id user@server' because it specifically installs the public key on the remote server's authorized_keys file, enabling passwordless login. The other options either do not transfer the public key correctly or do not perform the intended function of enabling passwordless SSH access.