Skip to content

Instantly share code, notes, and snippets.

@ijin
Last active April 2, 2016 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ijin/8cb28ac605eb3d43730393d961a19479 to your computer and use it in GitHub Desktop.
Save ijin/8cb28ac605eb3d43730393d961a19479 to your computer and use it in GitHub Desktop.
Put public key in ~/.ssh/authorized_keys with mucho ease
IFS="$(printf '\n\t')"
mkdir -p ~/.ssh
if ! [[ -f ~/.ssh/authorized_keys ]]; then
echo "Creating new ~/.ssh/authorized_keys"
touch ~/.ssh/authorized_keys
fi
grep -q "$1" ~/.ssh/authorized_keys || echo "$1" >> ~/.ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment