Skip to content

Instantly share code, notes, and snippets.

@coto
Created October 29, 2010 03:10
Show Gist options
  • Save coto/652818 to your computer and use it in GitHub Desktop.
Save coto/652818 to your computer and use it in GitHub Desktop.
Create & Upload a RSA Key for Github and others
mkdir -p ~/.ssh
ssh-keygen -t rsa -C "your_email@youremail.com"
scp -P $port ~/.ssh/id_rsa.pub $user@$ip:/$folder/
echo "==================================================================="
echo "============= Local Key ==============="
echo "==================================================================="
cat ~/.ssh/id_rsa.pub
echo "==================================================================="
echo "============= Remote ==============="
echo "==================================================================="
echo -e "Put this on remote:\n\t"
mkdir -p /$folder/.ssh;
mv -f /$folder/id_rsa.pub /$folder/.ssh/authorized_keys;
chown -R $user:$user /$folder/.ssh;
chmod 700 /$folder/.ssh; chmod 600 /$folder/.ssh/*
echo -e "\n\tcat /$folder/.ssh/authorized_keys"
echo "==================================================================="
ssh -p $port $user@$ip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment