Generating an SSH public key

To use SSH to sign in to your web server and connect to your Git code repository, you must have an SSH private/public key pair. This page describes two methods that you can use to generate an SSH private/public key pair: Acquia Dev Desktop and the ssh-keygen command. Your SSH public key must be at least 4096 bits.

Acquia Dev Desktop (Recommended)

One very easy way to generate an SSH private/public key pair is to use Acquia Dev Desktop.

For information about downloading and installing Acquia Dev Desktop for free, see Installing Dev Desktop.

To learn how to create an SSH key and register it with Acquia Cloud, see Generating an SSH key.

ssh-keygen

You can also use the ssh-keygen command from the command line to generate an SSH private/public key pair.

To generate an SSH private/public key pair, complete the following steps:

  1. Open a shell or command-line window on your computer.
  2. Ensure that you do not already have a public key saved to your computer. To do this, run the following command:

    cd ~/.ssh
    ls -l

    If the directory and key file exists, run the following commands to back up the key id_rsa, as this procedure overwrites your current key if it is named id_rsa.

    mkdir key_backup
    mv id_rsa* key_backup

  3. Generate a new public/private key pair using the keygen command:

    ssh-keygen -b 4096

    The keygen command prompts you for the directory to contain the key.

    Generating public/private rsa key pair.
    Enter file in which to save the key (/Users/[user_dir]/.ssh/id_rsa):

    Press the Enter key to accept the default location of /.ssh/id_rsa in your user directory.

    Enter passphrase (empty for no passphrase): [passphrase]
    Enter same passphrase again: [passphrase]

    Substitute [passphrase] with your own text. This is for encrypting the private key on your computer. It is possible to use a blank [passphrase], but if you do this, another user can impersonate you with a copy of the key file.

    The keygen command displays the following output:

    Generating public/private rsa key pair.
    Your identification has been saved in /Users/[user_dir]/.ssh/id_rsa.
    Your public key has been saved in /Users/[user_dir]/.ssh/id_rsa.pub.
    The key fingerprint is:
    52:96:e9:c8:06:c2:57:26:6d:ef:2f:0c:d9:81:f4:1c username@hostname

  4. Copy the key to your clipboard. To simplify the process, you can run the following code to copy the key from the id_rsa.pub file to your clipboard:

    pbcopy < ~/.ssh/id_rsa.pub

    Alternatively, using your favorite text editor, you can open the ~/.ssh/id_rsa.pub file, and then copy the contents of the file manually.

After you create and obtain the key, you can add the public key to your Acquia user profile in Acquia Cloud.

Sign in to vote or comment