Set Up Your Default Identity

By default, the system adds keys for all identities to the /Users/yourname/.ssh directory. The following procedure creates a default identity.

  • Open a terminal in your local system.
  • Enter ssh-keygen at the command line.
    The command prompts you for a file to save the key in:
    manthony@PHOENIX ~
    $ ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Documents and Settings/manthony/.ssh/id_
    rsa):
            
    
  • Press enter to accept the default key and path, /c/Documents and Settings/manthony/.ssh/id_rsa, or you can create a key with another name.
    To create a key with a name other than the default, specify the full path to the key. For example, to create a key called my-new-ssh-key, you would enter a path like this at the prompt:
    manthony@PHOENIX ~
    $ ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Documents and Settings/manthony/.ssh/id_
    rsa): /c/Documents and Settings/manthony/My Documents/keys/my-new-ssh-key
            
    
  • Enter and renter a passphrase when prompted.
    Unless you need a key for a process such as script, you should always provide a passphrase.
    The command creates your default identity with its public and private keys. The whole interaction looks similar to the following:
    manthony@MANTHONY-PC ~
    $ ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/manthony/.ssh/id_rsa):
    Created directory '/c/Users/manthony/.ssh'.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /c/Users/manthony/.ssh/id_rsa.
    Your public key has been saved in /c/Users/manthony/.ssh/id_rsa.pub.
    The key fingerprint is:
    e7:94:d1:a3:02:ee:38:6e:a4:5e:26:a3:a9:f4:95:d4 manthony@MANTHONY-PC
    manthony@MANTHONY-PC ~
    $
            
    
  • List the contents of ~/.ssh to view the key files.
    You should see something like the following:

    $ ls ~/.ssh

    id_rsa id_rsa.pub

    The command created two files, one for the public key ( for example id_rsa.pub ) and one for the private key (for example, id_rsa ).