Skip to content

Instantly share code, notes, and snippets.

@Juul
Created June 29, 2018 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Juul/726d85b429b394e2bdde375ef7de2e71 to your computer and use it in GitHub Desktop.
Save Juul/726d85b429b394e2bdde375ef7de2e71 to your computer and use it in GitHub Desktop.
Copy your ssh public key to authorized keys for root on a system running dropbear (e.g. OpenWRT)
#!/bin/bash
if [ "$#" -ne "1" ]; then
echo "" > /dev/stderr
echo "Error: Invalid number of arguments" > /dev/stderr
echo "" > /dev/stderr
echo "Usage: $0 ip_or_hostname" > /dev/stderr
echo "" > /dev/stderr
exit 1
fi
rhost=$1
ssh root@$rhost "tee -a /etc/dropbear/authorized_keys" < ~/.ssh/id_rsa.pub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment