Skip to content

Instantly share code, notes, and snippets.

@zanloy

zanloy/gensshkey.sh

Created Sep 24, 2014
Embed
What would you like to do?
Regenerate SSH host keys
#!/bin/bash
#Tested in RedHat but should work in other distros.
#set -x
rm -f /etc/ssh/ssh_host_key
rm -f /etc/ssh/ssh_host_key.pub
rm -f /etc/ssh/ssh_host_rsa_key
rm -f /etc/ssh/ssh_host_rsa_key.pub
rm -f /etc/ssh/ssh_host_dsa_key
rm -f /etc/ssh/ssh_host_dsa_key.pub
ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key
ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -t dsa -N '' -f /etc/ssh/ssh_host_dsa_key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.