Articles on Emerging Technologies, Cloud Computing and Cyber Security

Sunday, November 24, 2019

Creating an SSH Key Pair on the Command Line

To create an SSH key pair on the command line using ssh-keygen:
  1. Open a shell for entering the commands.
  2. At the prompt, enter the following:
       ssh-keygen -t rsa -N "" -b "2048" -C "key comment" -f path/root_name
    where the arguments are as follows:
    -t rsaUse the RSA algorithm.
    -N "passphrase"
    Passphrase to protect the use of the key (like a password). If you don't want to set a passphrase, don't enter anything between the quotes.
    Note: While a passphrase is not required, you should specify one as a security measure to protect the private key from unauthorized use.
    -b "2048"
    Generate a 2048 bit key. You don't have to set this if 2048 is acceptable, as 2048 is the default.
    Note: A minimum of 2048 bits is recommended for SSH-2 RSA.
    -C "key comment"A name to identify the key.
    -f path/root_name
    The location where the key pair will be saved and the root name for the files. For example, if you give the root name as id_rsa, the name of the private key will be id_rsa and the public key will be id_rsa.pub.
    For example,
    Command prompt - creating key pair, specifying parameters
    Alternatively, you can simply enter ssh-keygen and then enter responses when prompted for a name and a passphrase. The keys will be created with default values: RSA keys of 2048 bits.
  3. Command prompt, creating key pair without parameters
    To see that the files were created, type ls path/root_name*, for example,
  4. Command prompt, using li command to see files
     

0 Comments: