1

I’ve helped a middle school build custom images for using the Raspberry Pi in classes for many years. I’ve just booted the 2022-09-22 RasPi OS for the first time. Part of the initial boot process was “Generating SSH keys.”

What are the implications of this for making a master SD and copying it?

Obviously all the copies will have the same SSH keys… unless there’s some magic to detect that. What are those SSH keys used for? Is it OK for many copies to have the same keys in the classroom setting? What does one have to do to cause each copy to generate its own SSH keys if that’s necessary?

Thanks!

1 Answer 1

1

This is standard for all Linux computers (and probably others). (So this is not a Pi specific question). In the bad old days you had to manually generate keys.

For most users these are only relevant for ssh although they are used in many places to uniquely identify the host.

The one aspect of the Pi which differs from "normal" computers is the ease of moving SD Cards between machines. There is no problem in having identical keys.

Indeed having different keys can cause problems, as using different keys will cause problems if you have multiple SD Cards as the MAC & key combination will cause other machines to identify a problem.

I go to some effort to make sure ALL my SD Cards for different OS have IDENTICAL keys so I can effortlessly swap SD Card/OS and only change every 2 years with a new OS.

In short it is unlikely to make any difference for most users.

It is a simple procedure to change keys if you want them to be unique. I use the following to Recreate ssh host keys:-

sudo rm /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server

If you want to explore further https://unix.stackexchange.com/ is a better place to ask (although many would consider duplicated keys a security violation).

2
  • Although standard for Linux, it is new with the RasPiOS.
    – Bob Brown
    Commented Oct 22, 2022 at 16:49
  • 1
    @BobBrown it may be new to print a message but AFAIK keys were always generated by Raspbian.
    – Milliways
    Commented Oct 22, 2022 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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