Redhat – When are root’s SSH keys generated

anacondakickstartredhatssh-keygenssh-keys

I have hosts with and without keys in /root/.ssh. I've noticed before some on screen feedback for SSH key generation on start up (first time.) But I am not sure what the catalyst is. I have looked in /root/anaconda-ks.cfg and don't see anything different that could lead to this.

What was chosen/enabled for the servers that do versus the ones that do not?

Note: I know I can do it manually — I am just looking to understand when / how it is inconsistently generated.

Best Answer

I think you are confusing it with host keys.

Host keys are generated on first boot. (Well, or when the ssh server starts the first time).

The directory /root/.ssh is created when you first use ssh (the client). It stores the known_hosts file here (containing the public keys of hosts your have been connected before).

One can use ssh-keygen to create public/private keypair (it is name /root/.ssh/id_rsa and /root/.ssh/id_rsa.pub per default).