Easy SSH Authentication

Alex Todd
2 min readJan 7, 2017


If you’ve ever used SSH to remote into a server, you’ve had to type your password a few times. Setting up a SSH key creates a trust between your local computer and your server, allowing you to login without having to type your password. Below are step-by-step guides for creating a SSH key on Windows and macOS/Linux.

Generate Private and Public Keys

Perform the following steps on your local machine.


Start off by downloading PuTTy and PuTTYgen.

After opening PuTTYgen, towards the bottom of the window under “Type of key to generate” make sure that “SSH-2 RSA” is selected. Click the generate button.

In order to generate the key move the mouse around in the blank area of the PuTTYgen window. Once they key is generated, add any comment you like into the Key comment field. If you’d like to set a passphrase (password would be required upon connection) you can set it in the Key passphrase field and confirm it in the Confirm passphrase field.

Be sure to click “Save public key” and “Save private key”! These files are required to connect to your server!

To connect in PuTTY, enter your server IP address. The port should be 22 and connection type is SSH. On the left side of PuTTY click on Data under Connection. Enter your username in the “Auto-login username” field. Next click on the plus button next to SSH under Connection and select Auth. At the bottom of the window click on Browse and select the private key you created above. You can then go back to the Session menu, type a name into the Saved Sessions box and click save. The connection settings will be available to load the next time you run PuTTY. Click open and you should be connected to your droplet.


Open up the terminal application on your local computer and run


Press enter to save your keys in the default location (~/.ssh/id_rsa). For the next two prompts either type a password that you’ll be asked when connecting, or press enter for no password.

Setup your Server

Perform the following steps on your remote server.


If your local computer is running Windows, go ahead and remote into your server and navigate to the .ssh directory.

cd ~/.ssh

Open a file called authorized_keys and paste the contents of your public key file id_rsa.pub.

sudo nano authorized_keys


If your local computer is running macOS or Linux, just run the following command to setup your public key, replacing demo@myserver.com with your username and server/ip address.

ssh-copy-id demo@myserver.com

You’ve now setup your very own SSH key! To test if it works, just try connecting to your server. If you didn’t specify a ssh password you should be automatically logged in!