Which command is used to manage SSH known hosts and public keys?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

The command used to manage SSH known hosts and public keys is ssh-keygen. This utility is primarily responsible for generating new SSH key pairs, which consist of a private and a public key. However, it also plays a crucial role in managing existing keys.

When you need to create a new key for SSH authentication, you would typically use ssh-keygen to generate it. This command can also be used to display the fingerprint of an existing key or convert keys between different formats. Additionally, ssh-keygen can be utilized to manage known hosts by adding or modifying the entries in the known_hosts file, which stores the public keys of known SSH hosts to prevent man-in-the-middle attacks.

While ssh-add and ssh-agent are related to managing your SSH keys during an active session (specifically, loading private keys into memory and handling agent forwarding), they do not directly manage known hosts. The command ssh-copy-id is used for copying public keys to the remote machine’s authorized_keys file for easy SSH access but does not handle the management of known hosts or key generation itself.

Thus, ssh-keygen is the correct tool for managing both SSH known hosts and public keys effectively.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy