Skip to content

Instantly share code, notes, and snippets.

@andax
Forked from hongkongkiwi/generate-dropbear-key
Created February 28, 2022 20:51
Show Gist options
  • Save andax/9d0ec6ea92003e890e175e723d9c5d14 to your computer and use it in GitHub Desktop.
Save andax/9d0ec6ea92003e890e175e723d9c5d14 to your computer and use it in GitHub Desktop.
Generate SSH Key in Dropbear
#!/bin/bash
KEY_DIR="/mnt/sda1/.ssh"
# Make directories
mkdir -p "$KEY_DIR"
# Generate an RSA key using dropbear
dropbearkey -t rsa -f "${KEY_DIR}/id_rsa"
# Output Public Key
dropbearkey -y -f "${KEY_DIR}/id_rsa" | grep "^ssh-rsa " > "${KEY_DIR}/id_rsa.pub"
# Show Public Key
cat "${KEY_DIR}/id_rsa.pub"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment