SSH Key Gen & SSH Keys on windows system to Linux Server
NAMEssh-keygen - authentication key generation, management and conversion
ssh-keygen generates, manages and converts authentication keys for ssh. ssh-keygen can create RSA keys for use by SSH protocol version 1 and DSA, ECDSA or RSA keys for use by SSH protocol version 2. The type of key to be generated is specified with the -t option. If invoked without any arguments, ssh-keygen will generate an RSA key for use in SSH protocol 2 connections.
SSH Key Generation:
[nsk@nsk-linux ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/nsk/.ssh/id_rsa): - Just give enter
Enter passphrase (empty for no passphrase): - Dont give passphrase
Enter same passphrase again:
Your identification has been saved in /home/nsk/.ssh/id_rsa.
Your public key has been saved in /home/nsk/.ssh/id_rsa.pub.
The key fingerprint is:
ae:67:71:78:9e:b5:31:1e:bb:7b:c7:0a:3b:18:0b:c8 nsk@nsk-linux
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| |
| . .S. |
| E.+ + = |
| .* B.* . |
| .o = =o. o|
| .o +=.o |
+-----------------+
[nsk@nsk-linux ~]$ cd .ssh/
[nsk@nsk-linux .ssh]$ ls -al
total 48
drwx------ 2 nsk nsk 4096 Dec 1 10:08 .
drwx------ 37 nsk nsk 4096 Nov 26 09:51 ..
-rw------- 1 nsk nsk 1675 Dec 1 10:08 id_rsa
-rw-r--r-- 1 nsk nsk 395 Dec 1 10:08 id_rsa.pub
-rw------- 1 nsk nsk 8594 Nov 7 08:23 known_hosts
We need to convert id_rsa key (windows to linux) for successful password less authentication from windows system
1. Save the id_rsa key in Windows system
2. Use Putty Key Generator tool & click the conversions



5. Copy id_rsa.pub key to /home/nsk/.ssh/authorized_keys (change the user home directory)
[nsk@nsk-linux .ssh]$ cat id_rsa.pub >> /home/nsk/.ssh/authorized_keys
[nsk@nsk-linux .ssh]$ cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAv4ZERTCXFpGZLrNKBOQfiTE5SEQYvtiolNt8KnMVY9bxwEUMyPUX9EwmJxW51BY8I9Xq6VGoU2nskS0GrTgqjAOeptTRia0ws7inkc9oHVHryqJdgvhYvpVj2lLsnRTO9Lv4P6Pkycvg5xioAKRTdL8EffPxWtu8x1iL6aYsHThxsrpmXzK0LrkHLnGsJT5nRtNOWlUJW9npNPRBSqRmPjFCRpWb2kgn7MUKJnr5rXA2kgrULCvx97EFDxA/HYAxFgld7yGdnPjdZWyrkXK/FsFmsU4xoGoSNVKG1Vq1R18rc/cNjtVPME9TBxD8OBB8FQYiyHLYWLF+x9EbGsY+lQ== nsk@nsk-linux
6. Here .ssh should be 0700 permission and authorized_keys should be 0600 permisssion.
7. Open putty tool - Enter the Server IP in session ==> expand the SSH ==> select AUTH and browse the key ==> Select the key


Hope it helps.
No comments:
Post a Comment