Skip to content

Instantly share code, notes, and snippets.

@Juul
Last active May 18, 2025 22:24
Show Gist options
  • Save Juul/3265ded190c09093c36e to your computer and use it in GitHub Desktop.
Save Juul/3265ded190c09093c36e to your computer and use it in GitHub Desktop.
ssh-copy-id but for openwrt / dropbear
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Example: ${0} [email protected]"
exit 1
fi
cat ~/.ssh/id_rsa.pub | ssh ${1} "cat >> /etc/dropbear/authorized_keys && chmod 0600 /etc/dropbear/authorized_keys && chmod 0700 /etc/dropbear"
@Sbgodin
Copy link

Sbgodin commented Jan 11, 2021

chmod -R go=- /etc/dropbear

Will remove all rights for Group and Others.

@lavinkabul
Copy link

How to run this script and which way to put it?

@Starksoft
Copy link

Starksoft commented May 18, 2025

Thanks for gist!

In some cases dropbear is in another dir.
For keenetic routers running opernwrt (xkeen) location is /opt/etc/dropbear

#!/bin/sh

if [ "$#" -ne 1 ]; then
  echo "Example: ${0} [email protected]"
  exit 1
fi

cat ~/.ssh/id_rsa.pub | ssh ${1} "cat >> /opt/etc/dropbear/authorized_keys && chmod 0600 /opt/etc/dropbear/authorized_keys && chmod 0700 /opt/etc/dropbear"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment