Generating SSH Keys on MacOS

Last Updated -


SSH keys are the perfect way to securely connect to your server over SSH/SFTP. At Pagely, we take your security very seriously and require all of our VPS and Enterprise hosting customers to use SSH keys when authenticating with their environments. In this article, we'll show you how to generate a new SSH key pair on MacOS.

Checking For Existing SSH Keys

Before generating a new SSH key pair, you might want to first check to see if you already have any SSH keys present. Here's how to check:

  1. Open a new Terminal window.
  2. Inside your terminal, enter the following to list your SSH keys:
    ls -al ~/.ssh
  3. Did you see any files ending in .pub, usually id_rsa.pub? That means you already have an SSH key configured! If you want to use an existing SSH key, you can skip the next section on generating SSH key pairs.

Generating a New SSH Key Pair

Ready to generate a new SSH key? Awesome! Let's get started:

  1. Open a new Terminal window.
  2. Next, generate a new SSH key pair using the following command:
    ssh-keygen -t rsa -C "your_email@example.com"
  3. After you enter the ssh-keygen command, you'll be prompted to enter a password for your key. We recommend that you secure your SSH keys with a password for additional security.

Your SSH key pair has now been generated! This includes a public key that will be named id_rsa.pub and your private key labeled id_rsa. Be sure to keep your private key as safe as you would a password.

Getting Your SSH Public Key

Need to get your SSH key to add it to your Pagely account? Here's how to do it:

  1. Open a new Terminal window.
  2. Enter this command to get your SSH key:
    cat ~/.ssh/id_rsa.pub

Further Reading

Now that you've generated an SSH key, you'll likely want to add the SSH key to your Pagely account.

Related Topics

Pagely is the Managed WordPress Hosting Platform designed to exceed the needs of media, business, and Enterprise customers alike. We help the world's biggest brands scale WordPress.

Copyright © 2006-2017 Pagely, Inc. All rights reserved.
Pagely® and WordPress® are registered trademarks.

Pagely
Powered by Zendesk