cp /path/to/my/key/id_rsa ~/.ssh/id_rsa cp /path/to/my/key/id_rsa.pub ~/.ssh/id_rsa.pub # change permissions on file sudo chmod 600 ~/.ssh/id_rsa sudo chmod 600 ~/.ssh/id_rsa.pub # start the ssh-agent in the background eval $(ssh-agent -s) # make ssh agent to actually use copied key ssh-add ~/.ssh/id_rsa
Here is what the above code is Doing:
1. Copying the private and public keys to the .ssh folder in the home directory.
2. Changing the permissions on the private key to 600.
3. Starting the ssh-agent in the background.
4. Adding the private key to the ssh-agent.