Created
January 4, 2009 04:13
-
-
Save adam12/43003 to your computer and use it in GitHub Desktop.
My mergekeys.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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