An Odd SSH Key Regeneration Question

Discussion in 'DIY and Makers Spot' started by pc-tecky, Feb 19, 2018.

  1. pc-tecky

    pc-tecky Member

    May 1, 2013
    Likes Received:
    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?
  2. JustinH

    JustinH Active Member

    Jan 21, 2015
    Likes Received:
    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

Share This Page