Skip to content

Instantly share code, notes, and snippets.

@Instagraeme
Created September 5, 2014 05:34
Show Gist options
  • Save Instagraeme/587ef043e719e1e9a59a to your computer and use it in GitHub Desktop.
Save Instagraeme/587ef043e719e1e9a59a to your computer and use it in GitHub Desktop.
#!/bin/sh
KEY="$HOME/.ssh/id_rsa.pub"
SERVERS="[email protected] [email protected] [email protected] webserver mediacenter"
if [ ! -f $KEY ];then
echo "private key not found at $KEY"
echo "* please create it with \"ssh-keygen -t rsa -b 2048\" *"
exit 1
fi
for SERVER in $SERVERS
do
echo "Putting your key on $SERVER... "
ssh -q $SERVER "umask 0077; mkdir -p ~/.ssh ; echo "`cat $KEY`" > ~/.ssh/authorized_keys"
echo "done!"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment