Skip to content

Instantly share code, notes, and snippets.

@Ham5ter
Last active October 9, 2022 15:38
Show Gist options
  • Save Ham5ter/6cf693f67a1792b55f294969647a4e6a to your computer and use it in GitHub Desktop.
Save Ham5ter/6cf693f67a1792b55f294969647a4e6a to your computer and use it in GitHub Desktop.
regenerate openssh-keys on first boot!
#!/bin/bash
#
# This Script Regenerates the OpenSSH Host Keys, and deletes itself afterwards!
# Put this Script in the "/etc/rc5.d/" directory.
#
# Version: 1.1
# Author: [email protected]
# Date 02.08.2016
# SPDX-License-Identifier: MIT
echo "Deletes the old SSH Host Keys!"
/bin/rm -fv /etc/ssh/ssh_host_*
echo "Regenerating the SSH Host Keys!"
dpkg-reconfigure openssh-server
# Delete the Script itself!
/bin/rm "$0"
@KeyboardInterrupt
Copy link

I updated the License, as you suggested (ham5ter here.),
Also I quote the $0 on Line 17, which in some cases might have been problematic otherwise ^^.
https://gist.github.com/Ham5ter/6cf693f67a1792b55f294969647a4e6a/revisions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment