SLES 11 SP4
Sponsored Link

SSH Key-Pair Authentication2015/11/28

 
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 and work it like follows.
# create key-pair

suse@dlp:~>
ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/suse/.ssh/id_rsa):    
# Enter with default

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

Enter same passphrase again:
Your identification has been saved in /home/suse/.ssh/id_rsa.
Your public key has been saved in /home/suse/.ssh/id_rsa.pub.
The key fingerprint is:
f4:ea:95:bb:7b:3e:03:8c:1c:a8:bc:2e:af:cf:7f:12 [MD5] suse@dlp
The key's randomart image is:

suse@dlp:~>
mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys

suse@dlp:~>
chmod 600 ~/.ssh/authorized_keys

[2] Transfer the secret key created on the Server to a Client, then it's possbile to login with keys authentication.
suse@www:~>
mkdir ~/.ssh

suse@www:~>
chmod 700 ~/.ssh
# copy the secret key to local ssh directory

suse@www:~>
scp suse@10.0.0.30:/home/suse/.ssh/id_rsa ~/.ssh/

password:
id_rsa
suse@www:~>
ssh -i ~/.ssh/id_rsa suse@10.0.0.30

Enter passphrase for key '/home/suse/.ssh/id_rsa':  
# passphrase

Last login: Sat Nov 21 22:14:18 2015 from 10.0.0.5
suse@dlp:~>  
# just logined

[3] If you set "ChallengeResponseAuthentication" no, it's more secure.
dlp:~ #
vi /etc/ssh/sshd_config
# line 76: uncomment and change

ChallengeResponseAuthentication
no
dlp:~ #
/etc/init.d/sshd restart

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