Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 4 down vote accepted

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/ per default).

share|improve this answer
No, it's not host keys. I am looking at hosts with /root/.ssh/id_dsa /root/.ssh/ that I am confident that no one has ran ssh-keygen on. I think Setup Agent is creating the keys via the firstboot service but can't confirm that with any documentation / URL. I can test it tomorrow. I just was hoping that someone in the SF community would know. – Aaron Copley Nov 15 '10 at 22:11
Oh, ok. I am not that familiar with rhel and anaconda. I can think of anaconda generating the keys for some post-install activity, but it can be just my imagination. – cstamas Nov 15 '10 at 22:30
You are exactly right. Sorry for not understanding what you meant, but I finally found it. What I was seeing on first boot was the do_*_keygen routines from sshd's init script. (/etc/rc.d/init.d/sshd) It checks for the existence of /etc/ssh_host_key, /etc/ssh_host_rsa_key, and /etc/ssh_host_dsa_key and creates them as necessary. Seems I had made an incorrect correlation that lead me to think it was root user's keys, not host keys. Sorry! – Aaron Copley Sep 15 '11 at 21:00

Im 100% sure, you are talking about the keys when openssh-server is installed..

On basically every unix system, this happens on first boot after installation..
Regardless Im not sure i have ever seen a server without SSH..

Hope this helps.. :D

share|improve this answer
For what reason vote me down?? My answer is absolutely correct.. – Arenstar Nov 17 '10 at 3:44
No idea. I hate it when people do that without explanation. It's not correct in this case entirely but not worthy of a down vote. – Aaron Copley Nov 17 '10 at 20:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.