Skip to content

Instantly share code, notes, and snippets.

@yatesr
Created May 8, 2015 20:08
Show Gist options
  • Save yatesr/44b2d5b0e4bf87420459 to your computer and use it in GitHub Desktop.
Save yatesr/44b2d5b0e4bf87420459 to your computer and use it in GitHub Desktop.
openvz gen_ssh_host_key ubuntu-14.04
#!/bin/sh
### BEGIN INIT INFO
# Provides: Generates new ssh host keys on first boot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Generates new ssh host keys on first boot
# Description: Generates new ssh host keys on first boot
### END INIT INFO
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -b 4096 -N ""
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -t ed25519 -N ""
insserv -r /etc/init.d/ssh_gen_host_keys
rm -f \$0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment