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
![click_conversion_select_key click_conversion_select_key](https://3.bp.blogspot.com/-wbvRl6FhYG4/WiEUF2mgPKI/AAAAAAAAAa8/KYURP8NWcMUo6-6p0ofPHJtBbt4nkwVawCLcBGAs/s320/2ssh-fs8.png)
![Once_loaded_click_save_private_key_popup_yes Once_loaded_click_save_private_key_popup_yes](https://2.bp.blogspot.com/-55VDVnWUX0Y/WiEUb_qGJ9I/AAAAAAAAAbA/-UF95fm9Sf4KJ1ANeSIZnu8wVg4X9LkNgCLcBGAs/s320/3ssh-fs8.png)
![save_key_in_local_system save_key_in_local_system](https://4.bp.blogspot.com/-x5vsYWFtrZ4/WiEUiR76wYI/AAAAAAAAAbE/oVnjhAewhWscWR6PPeH2pZO1HbefuMNnwCLcBGAs/s320/4ssh-fs8.png)
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
![session_ip_ssh_AUTH_select_key session_ip_ssh_AUTH_select_key](https://1.bp.blogspot.com/-dph9HlXT438/WiEU2DotomI/AAAAAAAAAbM/fVFs3P-avIkPYFtmG4_PbRCQmiU7gPiWwCLcBGAs/s320/5ssh-fs8.png)
![ssh_with_key_authentication ssh_with_key_authentication](https://3.bp.blogspot.com/-ESyCey7x5Co/WiEU9HKjl9I/AAAAAAAAAbQ/3I-2bG1oyesQeA5FvILIQyqEYVznjm1NACLcBGAs/s320/6ssh-fs8.png)
Hope it helps.
No comments:
Post a Comment