Fedora 27
Sponsored Link

SSH Key-Pair Authentication
Configure SSH server to login with Key-Pair Authentication. Create a private key for client and a public key for server to do it.
[1] Create Key-Pair for each user, so login with a common user on SSH Client Host and then copy SSH public-key to the SSH Server.
[fedora@dlp ~]$
ssh-keygen -t ecdsa

Generating public/private ecdsa key pair.
Enter file in which to save the key (/home/fedora/.ssh/id_ecdsa):  
# Enter with default

Created directory '/home/fedora/.ssh'.
Enter passphrase (empty for no passphrase):  
# set passphrase (if set no passphrase, Enter with empty)

Enter same passphrase again:
Your identification has been saved in /home/fedora/.ssh/id_ecdsa.
Your public key has been saved in /home/fedora/.ssh/id_ecdsa.pub.
The key fingerprint is:
SHA256:0cIyJGVH5Eu1vBG81y0wZgFXFyKW31Oekmsk3VgQVvk fedora@dlp.srv.world
The key's randomart image is:

[fedora@dlp ~]$
ll ~/.ssh

total 8
-rw-------. 1 fedora fedora 314 Dec 14 14:14 id_ecdsa
-rw-r--r--. 1 fedora fedora 182 Dec 14 14:14 id_ecdsa.pub

# copy SSH public-key to the SSH Server

[fedora@dlp ~]$
ssh-copy-id www.srv.world

fedora@www.srv.world's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'www.srv.world'"
and check to make sure that only the key(s) you wanted were added.

# verify possible login or not

[fedora@dlp ~]$
ssh www.srv.world hostname

Enter passphrase for key '/home/fedora/.ssh/id_ecdsa':  
# passphrase (if not set, not required to input)

[2] If you set [PasswordAuthentication no] on SSH Server Host, it's more secure.
[root@www ~]#
vi /etc/ssh/sshd_config
# line 74: change to no

[root@www ~]#
systemctl restart sshd

SSH Key-Pair Auth from Windows Client
It's the example to login to SSH server from Windows Client. It uses Putty on here. Transfer a secret key to Windows Client first.
[3] Download [Puttygen.exe] from Putty Site and save it under the Putty directory. Next execute it and click [Load] button.
[4] Specify the secret key which you downloaded, then passphrase is required like follows, answer it.
[5] Click [Save private key] button to save it under a folder you like with any file name you like.
[6] Start Putty and open [Connection] - [SSH] - [Auth] on the left menu, then select the [private_key] which was just saved above.
[7] Back to the [Session] on the left menu and connect to the SSH server.
[8] The passphrase is required to input, then answer it. If it's correct passphrase, it's possible to login normally like follows.
Matched Content