Skip to content

Instantly share code, notes, and snippets.

@maxux
Created March 19, 2020 14:45
Show Gist options
  • Save maxux/c7d4590e558ef3f80e79e2ed42d5b297 to your computer and use it in GitHub Desktop.
Save maxux/c7d4590e558ef3f80e79e2ed42d5b297 to your computer and use it in GitHub Desktop.
#!/bin/ash
if [ -f /etc/ssh/ssh_host_rsa_key ]; then
# nothing to do, hackish way
sleep 10
exit 0
fi
echo "Setting up sshd"
mkdir -p /run/sshd
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa -b 521
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519
chmod 700 /root/.ssh
chmod 600 /root/.ssh/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment