Created
June 29, 2018 08:01
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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