Skip to content

Instantly share code, notes, and snippets.

@dch
Created November 20, 2015 14:12
Show Gist options
  • Save dch/4972cce2a7dcc954bbb7 to your computer and use it in GitHub Desktop.
Save dch/4972cce2a7dcc954bbb7 to your computer and use it in GitHub Desktop.
A dirty patch to ensure that debian systems regenerate their ssh host keys on reboot if they are missing
--- rc.local.orig 2015-11-20 09:02:06.776959957 -0500
+++ rc.local 2015-11-20 09:02:32.096652026 -0500
@@ -11,4 +11,9 @@
#
# By default this script does nothing.
+if [ -f /etc/ssh/regenerate_host_keys ]; then
+ rm -f /etc/ssh/ssh_host_*_key*
+ dpkg-reconfigure openssh-server
+ rm /etc/ssh/regenerate_host_keys
+fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment