Skip to content

Instantly share code, notes, and snippets.

@ammar
Created August 17, 2017 15:11
Show Gist options
  • Save ammar/1a9111f5cf925a7fa63d295a8e8561bf to your computer and use it in GitHub Desktop.
Save ammar/1a9111f5cf925a7fa63d295a8e8561bf to your computer and use it in GitHub Desktop.
#!/bin/bash
key=`cat ~/.ssh/id_rsa.pub`
for host in $*; do
ssh $host "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod -R 600 ~/.ssh/* && echo '$key' >> ~/.ssh/authorized_keys"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment