An Odd SSH Key Regeneration Question

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

pc-tecky

Active Member
May 1, 2013
202
26
28
So in following along various posts and tutorials for network booting (PXE) Raspberry Pi's, there is a line of code to regenerate the SSH private and public keys. Interesting indeed. So if the theory or case is that the primary system keys would be identical to the other PXE hosted keys for subsequent systems (A, B, C, D, etc.), then why is this regeneration of keys not needed for most other Linux distros and freshly burned images installed to computers, USB flash drives, or liveCDs?
 

JustinH

Active Member
Jan 21, 2015
124
76
28
48
Singapore
Most of the liveCD’s etc will create new SSH keys upon boot (unless you have some persistent storage).
When the keys are generated they are usually stored in /etc/sshd/ so on a PXE scenario all hosts that share the /etc directory would have the same keys.
For normal installs - when SSHD starts up it will check if keys exist and if not create new ones (via the startup scripts). By default the SSH packages don’t include any keys when you install the package.


Sent from my iPhone using Tapatalk