How do I create a ssh key with a specific name on linux?



  • Also see:
    ssh-keygen(1) — authentication key generation, management and conversion

    Note: The passphrase should be cryptographically strong.

         -t dsa | ecdsa | ed25519 | rsa
                 Specifies the type of key to create.  The possible values are
                 “dsa”, “ecdsa”, “ed25519”, or “rsa”.
    
         -f filename
                 Specifies the filename of the key file.
    
         -b bits
                 Specifies the number of bits in the key to create.  For RSA keys,
                 the minimum size is 1024 bits and the default is 2048 bits.  Gen‐
                 erally, 2048 bits is considered sufficient.  DSA keys must be
                 exactly 1024 bits as specified by FIPS 186-2.  For ECDSA keys,
                 the -b flag determines the key length by selecting from one of
                 three elliptic curve sizes: 256, 384 or 521 bits.  Attempting to
                 use bit lengths other than these three values for ECDSA keys will
                 fail.  Ed25519 keys have a fixed length and the -b flag will be
                 ignored.
    

    The default file name for RSA algorithm is id_rsa

    $ ssh-keygen -t rsa -b 4096 -f ~/.ssh/training.id_rsa
    Generating public/private rsa key pair.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/training/.ssh/training.id_rsa.
    Your public key has been saved in /home/training/.ssh/training.id_rsa.pub.
    The key fingerprint is:
    SHA256:YKHv33XSuhLTBecHVaDSPQWQQ4l46eh6T4VSbMWIICc training@universe
    The key's randomart image is:
    +---[RSA 4096]----+
    |      E o. o.O++.|
    |     . =  oo*=*  |
    |    . o   .=*.+. |
    |     o .. +++. o |
    |      . S+.+. .  |
    |     .    +.oo   |
    |      .  . ++ o  |
    |       ...oo +   |
    |        ...o+.   |
    +----[SHA256]-----+
    

Log in to reply
 

© Lightnetics 2024