Generate an SSH key pair on Windows
Keeping your online store safe and secure is our top priority. To maintain security of credentials and site as a whole, an SSH key pair is required for accessing your site over SFTP. In this article, we'll show you how to generate an SSH key pair on Windows.
Check for existing SSH key pairs
- Open up a new command prompt.
- Enter the following command to check for any existing files within your
.ssh
directory:
dir .ssh
If you see any files ending in
.pub
(typicallyid_rsa.pub
), 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 an SSH key pair
Ready to generate a new SSH key? Awesome! Let's get started:
- Start by opening a new Command Prompt window or if you followed the previous section, you can use the one that's already open.
- Next, issue the following command to generate a new SSH key pair:
ssh-keygen -t rsa
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.- 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 id_rsa.pub
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.
- Open a new Command Prompt window or use an existing open window.
- Enter the following command to output the contents of your public key:
Note: The following command assumes that your key pair is namedid_rsa
as described in previous steps. If you're using a key with a different name, you'll need to adjust the command accordingly.type .ssh/id_rsa.pub
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. To learn more about adding it, see our article on adding public keys to your Managed WooCommerce Stores account.