Ssh-keygen is command line tool for creating authentication key pairs for SSH Key based authentication. Private Key is used for client and the public key need to upload on server.
Step 1: Run the below command and press enter to create the pair:
Step 1: Run the below command and press enter to create the pair:
[root@linuxcnf ~]# ssh-keygen -b 2048 -t rsa -C "username"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:J069cKH8zV8KQsT+/tMuWt+ES/jXVDEegh/2oX/S36I username
The key's randomart image is:
+---[RSA 2048]----+
| . |
| . . + = |
| + o * =|
| . = . o o.|
| S * ...|
| o B = ..o+|
| . + * ++B|
| o *+*B|
| E+**+|
+----[SHA256]-----+
[root@linuxcnf ~]#
|
Note: Two files will be created inside /root/.ssh/ directory named id_rsa and id_rsa.pub. The file name id_rsa will be used as private key and id_rsa.pub will be public key (to upload on remote machine).
Step 2: Follow the article Howto add SSH public key to the Server in Centos 7 to configure SSH key based authentication on remote machine.
No comments:
Post a Comment