How to Set Up SSH keys on Mac for installing WordPress on DigitalOcean Droplet

Learn How To Create SSH Keys with OpenSSH on macOS and install WordPress on DigitalOcean Droplet.
This snippet requires the following Themes/Plugins/Services/Tools:
  • Mac Computer with the latest macOS
  • Steady Internet Connection
  • DigitalOcean Account [For Creating a WordPress Droplet]

STEP 1:

Open Terminal application on your Mac using SpotLight or find it in the applications folder of your Mac. If the app is already running, terminate or quit it and restart it to make sure it is pointing to the root directory.

Alternatively you can also use cd .. to go one level up the hierarchy.

NOTE: Make sure you also have admin access to this account on your Mac and is password/TouchID protected.

If this is your first time generating SSH keys proceed to step 2 else skip to step 4.

STEP 2:

Type ssh-keygen -t rsa in the terminal app to run the command. It starts generating public key/private key pair and also creates .ssh folder.

NOTE: -t rsa is optional here but it specifies the type of algorithm to be used for keys generation which is also the default method. You can simply type ssh-keygen and that should work just fine too.

STEP 3:

Leave blank for filename and hit return/enter. Skip to STEP 5.

STEP 4:

If you’re generating keys again for another application first type cd ~/.ssh and then type ssh-keygen.

Give any custom file name to prevent overwriting the actual key pair. Type customfilename and hit return.

STEP 5:

Leave blank for passphrase and hit return/enter. Once again for passphrase leave it blank and simply hit return.

You should get a message that the keys are generated and .ssh folder is successfully created(if it’s your first time doing SSH key gen).

STEP 6:

Type pbcopy < ~/.ssh/id_rsa.pub to copy your public key to clipboard.

If you've followed STEP 4 type pbcopy < ~/.ssh/customfilename.pub and hit return to copy new key to clipboard.


STEP 7:

Paste or Command+v in your digital ocean droplet to complete the droplet creation.

STEP 8:

Once the droplet is created, On your terminal app type ssh root@droplet_ip_address and that should automatically log in to your server .

If it asks you to add this fingerprint type yes. Then finish your droplet installation.

Alternatively you can press eclipses button next to your droplet and access console provided by digitalocean to finish the droplet installation.

STEP 9:

To see contents of your .ssh folder type cd ~/.ssh and in the next line type ls. This shows all the keys generated under .ssh folder. 

Also if you want to move one step above type cd ..
Copy the snippet from below:
ssh-keygen 

cd ~/.ssh

pbcopy < ~/.ssh/id_rsa.pub

pbcopy < ~/.ssh/yourfilename.pub 

cd ..

ls

NEW COURSE!

Learn Elementor Custom CSS from the scratch. Up your Web Design game!