Table of Contents

Linux Commands#network

ssh-keygen : How to use ssh-keygen command in Linux with examples




authentication key generation, management and conversion

ssh-keygen Option

$ ssh-keygen -?
unknown option -- ?
usage: ssh-keygen [options]
Options:
  -b bits     Number of bits in the key to create.
  -C comment  Provide new comment.
  -t type     Specify type of key to create.
  -R hostname Remove host from known_hosts file.
  -N phrase   Provide new passphrase.
  -f filename Filename of the key file.
$ man ssh-keygen

SYNOPSIS
     ssh-keygen [-q] [-b bits] [-t type] [-N new_passphrase] [-C comment] [-f output_keyfile]


     -t type
             Specifies the type of key to create.  The possible values are “rsa1” for protocol version 1 and “dsa”,
             “ecdsa”, “ed25519”, or “rsa” for protocol version 2.

     -R hostname
             Removes all keys belonging to hostname from a known_hosts file.


How to create key pairs

$ ssh-keygen -t rsa -b 4096 -C "" -N "" -f id_rsa_user1
$ ssh-keygen -t rsa -b 4096 -C "" -N "PASS" -f id_rsa_user1
$ ssh-keygen -t rsa -C ""


How to check encryption

$ ssh-keygen -l -f id_rsa.pub
2048 08:2f:8c:60:e8:ee:06:f1:d7:8b:d4:aa:5b:60:2a:e7   (RSA)
$






Linux Commands#network