Skip to content

Instantly share code, notes, and snippets.

@adam12
Created January 4, 2009 04:13
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 adam12/43003 to your computer and use it in GitHub Desktop.
Save adam12/43003 to your computer and use it in GitHub Desktop.
My mergekeys.sh
#!/bin/bash
function setup {
if [ ! -d ~/.ssh ]; then
echo "SSH folder doesn't exist, creating..."
mkdir ~/.ssh
fi
if [ ! -d ~/keys ]; then
echo "Keys folder doesn't exist, creating..."
mkdir ~/keys
fi
touch ~/.ssh/authorized_keys
}
function fixpermissions {
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
}
setup
if [ $(ls ~/keys | wc -l) -gt 0 ]; then
echo "Merging keys located in ~/keys..."
cat ~/keys/* > ~/.ssh/authorized_keys
else
echo "No keys to merge"
fi
fixpermissions
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment