1

I installed CentOS 7, and noticed that I have rsa and ecdsa keys generated. I deleted all of them and rebooted the machine. I got a new pair of rsa and ecdsa keys.

How does Linux generate the keys? When is ssh-keygen called..? I couldn't find the configuration for this...

  • Could you give more precision about the keys? Where the keys are generated? Which keys? – Artiom Sep 22 '14 at 14:05
  • I do not think Linux does anything like this on boot. It is likely that you have some service installed (eg. Docker deamon) which is generating a keypair for you. – mkc Sep 22 '14 at 14:19
  • @Ketan RHEL does actually generate the ssh keypair on boot if the ID files don't already exist. It's part of the /etc/init.d/sshd script on RHEl5 and RHEL6. I just don't know how RHEL7 works well enough to answer this question. – Bratchley Sep 22 '14 at 14:30
2

sshd's daemon is started by /etc/init.d/sshd (more precisely from a link located in /etc/rc$x.d ).

upon starting sshd, a check is made over existence of key files. if those file are missing ssh-keygen will be call.

  • 1
    This is on RHEL7 which is going to have a systemd system of initialization. The script you reference is for SysVinit. – Bratchley Sep 22 '14 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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