XK0-005 · Question #10070
A junior Linux administrator needs to access production servers using a secure SSH protocol. Which of the following files should contain the public key to gain remote access to the server?
The correct answer is D. ~/.ssh/authorized_keys. The public key for SSH authentication is stored in the authorized_keys file within the user's hidden .ssh directory in their home directory.
Question
Options
- A~/ssh/authorized-keys
- B/etc/authorized_keys
- C/etc/sshd/ssh.conf
- D~/.ssh/authorized_keys
How the community answered
(47 responses)- A2% (1)
- B2% (1)
- C6% (3)
- D89% (42)
Why each option
The public key for SSH authentication is stored in the `authorized_keys` file within the user's hidden `.ssh` directory in their home directory.
This path uses a hyphen instead of an underscore for `authorized-keys` and is not the standard location.
/etc/authorized_keys is not the standard or correct location for user-specific SSH public keys; /etc is for system-wide configuration.
/etc/sshd/ssh.conf is not a standard path for SSH configuration and public keys are not stored in a configuration file like this, but in `authorized_keys`.
For secure SSH key-based authentication, the public key of the client is placed in the `~/.ssh/authorized_keys` file on the server. The `~` symbol represents the user's home directory, and `.ssh` is a hidden directory specifically for SSH configuration and keys. When an SSH client attempts to connect, the server checks the public key provided by the client against the keys listed in this file.
Concept tested: SSH public key authentication file location
Source: https://man7.org/linux/man-pages/man8/sshd.8.html
Topics
Community Discussion
No community discussion yet for this question.