This tutorial explains how you can replace password-based SSH authentication with key-based authentication which is more secure because only the people that own the key can log in. In this example, we're using PuTTY as our SSH client on a Windows system.
You can download requaired components from this link: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
1. Generate a private and public key pair
Open PuTTYgen.exe, press Generate button, move mouse. Once the keys are generated, type your key passphrase (choose a "hard to guess" one). Save Public key. Save Private key.
2. Now login into linux using SSH and goto /root/.ssh folder. There create one file "authorized_keys2". Copy content of publickey generated on Windows PC into "authorized_keys2" file.
or copy public file from windows PC to linux and run below command it will automatically add public key content to authorized_keys2 file.
ssh-keygen -i -f mypublicKey.pub >> .ssh/authorized_keys
It should look something like
ssh-rsa AAAAC1sdf#FasdccP1....
Then change its permission to 700
chmod 700 authorized_keys2
3. Add private key to putty SSH authentication agent.
Start the putty SSH authentication agent PAGENT.EXE. When started, right-click on and then click on "Add Key" , give the path of Private key generated. Now you can start session to Linux PC through putty. You will be asked for username, but not password.. ;)
You can download requaired components from this link: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
1. Generate a private and public key pair
Open PuTTYgen.exe, press Generate button, move mouse. Once the keys are generated, type your key passphrase (choose a "hard to guess" one). Save Public key. Save Private key.
2. Now login into linux using SSH and goto /root/.ssh folder. There create one file "authorized_keys2". Copy content of publickey generated on Windows PC into "authorized_keys2" file.
or copy public file from windows PC to linux and run below command it will automatically add public key content to authorized_keys2 file.
ssh-keygen -i -f mypublicKey.pub >> .ssh/authorized_keys
It should look something like
ssh-rsa AAAAC1sdf#FasdccP1....
Then change its permission to 700
chmod 700 authorized_keys2
3. Add private key to putty SSH authentication agent.
Start the putty SSH authentication agent PAGENT.EXE. When started, right-click on and then click on "Add Key" , give the path of Private key generated. Now you can start session to Linux PC through putty. You will be asked for username, but not password.. ;)