Generating SSH key pairs
Procedure
-
Create the directory in which the keys are stored:
mkdir -p ~/.ssh
-
Create the key pairs:
ssh-keygen -t rsa
-
Generate the key pair "public/private rsa".
-
Enter the storage location of the key, e.g. /home/root/.ssh.
-
Enter the password.
If you do not enter a password, then leave the entry empty. -
Repeat the password.
Your identification is stored in the following directory: /home/root/.ssh/id_rsa.
Your public key is stored in the following directory: /home/root/.ssh/id_rsa.pub.
The fingerprint of the key is shown as follows:
SHA256:vN0y+nIMQ0Nb5UOBkZ8upyVa4wwf/8Z1lDg7TJcMvrg root@iot2000
The Randomart Image of the key is:
-
-
Copy the public key with the command "
ssh-copy-id
" -
Ensure that the example name and the IP address have been replaced:
cat ~/.ssh/id_rsa.pub | ssh root@192.168.0.198 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys
-
The following will be displayed:
The authenticity of host '192.168.0.198 (192.168.0.198)' can't be established.
ECDSA key fingerprint is SHA256:KwhYZhX1APiu1K0WXUkTmzF35S9VDhqv0YcFo5/KSWg.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.198' (ECDSA) to the list of known hosts.
DISPLAY "(null)" invalid; disabling X11 forwarding
-
You can find more information on key pairs at