Skip to content

Instantly share code, notes, and snippets.

@saml
Created August 29, 2012 18:32
Show Gist options
  • Save saml/3516754 to your computer and use it in GitHub Desktop.
Save saml/3516754 to your computer and use it in GitHub Desktop.
#!/bin/bash
pubkey_path="$1"
if (( $# < 1 ))
then
pubkey_path="$HOME/.ssh/id_rsa.pub"
fi
pubkey="$(cat "$pubkey_path")"
cat <<EOF
chmod 700 ~/
mkdir -p ~/.ssh/
chmod 700 ~/.ssh/
echo "$pubkey" >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment