Creating a new Key pair in Mac OS X or Linux

Overview

ssh-keygen is a program that can be found on Mac, Linux, and other UNIX-based operating systems. For more information about the program, check out Wikipedia's entry on the subject here:

Creating a Key pair

To generate a new Key pair, run the following commands on your home computer.

  1. Open your terminal and run the following command under your username.
    [local]$ ssh-keygen -t rsa
    This creates a public/private keypair of the type (-t) rsa.
    Generating a public/private rsa key pair.
    Enter the file in which you wish to save they key (i.e., /home/username/.ssh/id_rsa):
    
  2. Press Enter on your keyboard to continue with the default directory and name.

    The prompt defaults to save the new key pair in the /home/username/.ssh/ directory and name it id_rsa. However, you can adjust the location or name of the file here if you like by typing in the full path.

    Enter a passphrase (leave empty for no passphrase).
  3. Press Enter on your keyboard to continue.

    It's not recommended that you use a passphrase.

    Enter same passphrase again:
  4. Press Enter on your keyboard to continue.
    The following message appears:
    Your identification has been saved in /home/username/.ssh/id_rsa
    Your public key has been saved in /home/username/.ssh/id_rsa.pub
    
    The key fingerprint is:
    ar:bc:d3:9e:g3:1f:63:6f:6b:32:2e:97:ee:42:e1:be username@server.dreamhost.com
    
    The key’s randomart image is:
    
    +--[ RSA 2048]----+
    | ..+**B.o++o     |
    |  . o+==o. o     |
    |    . .oo.=      |
    |      . +E+ .    |
    |        S .      |
    |                 |
    |                 |
    |                 |
    |                 |
    +-----------------+
    
  5. Run the following command to view the new private and public key:
    [local]$ ls -1 ~/.ssh/
    id_rsa
    id_rsa.pub
  6. Import the public key into your DreamCompute dashboard.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?