Generate ssh host keys
From radmind
This script will generate ssh host keys if they files are missing or empty. To use this script, add the following files to a negative transcript:
- ./private/etc/ssh_host_dsa_key
- ./private/etc/ssh_host_dsa_key.pub
- ./private/etc/ssh_host_key
- ./private/etc/ssh_host_key.pub
- ./private/etc/ssh_host_rsa_key
- ./private/etc/ssh_host_rsa_key.pub
#!/bin/sh SSH-KEYGEN=/usr/bin/ssh-keygen [ ! -s /etc/ssh_host_key ] && $SSH-KEYGEN -q -t rsa1 \ -f /etc/ssh_host_key -N "" -C "" < /dev/null > /dev/null 2> /dev/null [ ! -s /etc/ssh_host_rsa_key ] && $SSH-KEYGEN -q -t rsa \ -f /etc/ssh_host_rsa_key -N "" -C "" < /dev/null > /dev/null 2> /dev/null [ ! -s /etc/ssh_host_dsa_key ] && $SSH-KEYGEN -q -t dsa \ -f /etc/ssh_host_dsa_key -N "" -C "" < /dev/null > /dev/null 2> /dev/null exit 0