Managed WooCommerce Stores Help

Generating an SSH key pair on macOS

When you're working with payments, security is a top priority. Rather than typical password authentication that can be easily circumvented, we require authentication via SSH key pairs to connect over SFTP. In this article, we'll show you how to generate an SSH key pair on MacOS.

Check for existing SSH key pairs

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. On your computer, open a new Terminal window.
  2. Inside your terminal window, enter the command to list any existing SSH key pairs:
    ls -al ~/.ssh
  3. If you see any files ending in .pub (typically, you already have an existing SSH key pair. If you want to continue using this existing key pair, you're free to skip the next section and head on over to grabbing the contents of your public key.

    If you'd prefer to use a different key pair, the next section will show you how to generate one.

Generate a new SSH key pair

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

  1. Start by opening a new Terminal window or if you followed the previous section, you can use the one that's already open.
  2. Issue this command to change the directory:
    cd .ssh
  3. Next, issue the following command to generate a new SSH key pair:
    ssh-keygen -t rsa
  4. After entering the ssh-keygen command, you'll be asked where you want to save your key pair.

    Unless you have a specific reason for storing your SSH key elsewhere, such as if you already have an existing key pair that you want to keep, the default path and id_rsa filename will be fine. Just leave the prompt blank and press the Enter key to use the default location.

  5. Lastly, you'll be prompted to secure your SSH keys with a password. While this step is optional, we highly recommend setting a passphrase as a security best practice.

Your SSH key pair has now been generated! This includes a public key that will be named and your private key labeled id_rsa. Since this private key controls access to your account, be sure to keep your private key as safe as you would a password.

Get your SSH public key

After your key pair has been generated, you'll need to access your public key. Here's how to do it.

  1. Open a new Terminal window or use an existing open window.
  2. Enter the following command to output the contents of your public key:
    Note: The following command assumes that your key pair is named id_rsa as described in previous steps. If you're using a key with a different name, you'll need to adjust the command accordingly.
    cat ~/.ssh/

With an SSH key pair in hand, you're almost ready to connect to your site over SFTP. Next, you'll need to associate the public key with your Managed WooCommerce Stores account.

More info

Share this article