Copy SSH keys for easy and quick access to servers

SSH keys are great. It allows you to login to servers and SSH-based serveices without using passwords.

Before using SSH keys, you need to create an key:

ssh-keygen -t dsa

Answer a few questions, and then you will have a new pair of keys. Now, copy the key to the remote server:

ssh-copy-id user@remote-host

If you are on OSX, you can install the utility with homebrew:

brew install ssh-copy-id

Or download it using the following command from this github repo:

curl -L | sh

If you are on Windows, you can use the following command (credit to Andres Gonzalez):

cat ~/.ssh/ | ssh user@remote-host “mkdir ~/.ssh; cat <<; ~/.ssh/authorized_keys”

Posted in devops Tagged with:

Leave a Reply

Your email address will not be published. Required fields are marked *