Secure Shell (SSH) is a network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that it connects via a secure channel over an insecure network: a server and a client (running SSH server and SSH client programs, respectively).
In SSH when a client computer connects to the server, the server requires the client to authenticate itself. There are different ways a client can authenticate itself to the server. A typical authentication mode will be to enter a password when logging into a remote system. In this tutorial we can explore another mode of authentication in which server doesn’t require a password to be entered by the user.
So lets Start :
Client Configuration (WINDOWS)
1. Go to the client computer. We are using windows as client computer. Download Putty and Puttygen from following
URL
PUTTY
PUTTYGEN
Using the Puttygen tool we will generate an authentication key. This key will serve as a substitute for the password that will be entered during login.
2. Start puttygen.

3. The following window opens up. Leave the default ‘SSH-2 RSA’ selection and click on the ‘Generate’ button.

4. The following window opens. Move mouse randomly over the empty space below the progress bar to create some randomness in the generated key.

5. Don’t enter any key phrase. Click on ‘Save private Key’ button. Click ‘Yes’ on the window asking for confirmation for saving the key without a password.


6. Save the key file to a safe location. We will be saving the file in C:\Vidyadhar as 192.168.1.2.ppk. 192.168.1.2 is my SSH server ip. Now you can close the Puttygen window.


7. Open the 192.168.1.2.ppk file in a notepad. Copy the four lines under ‘Public-Lines’ section to windows clipboard

Server Configuration (UBUNTU)
1. Now open putty and connect to the remote system using the user id you want to use for future no password connections. At my system I am going to login through vidyadhar user. This time when you login, you have to provide the password at the prompt. Future logins won’t require this password

2. Under the logged in user’s home directory there will be .ssh directory, under that create a new file called authorized_keys using a text editor such as vi.
In our case the file will be created under /home/vidyadhar/.ssh/authorized_keys
cd ~/.ssh/
vi authorized_keys

3. Type the word ssh-rsa (including spaces on both ends of the word) and paste the 4 lines copied from step 7 from client configuration. Remove the carriage return at end of each line, merging four lines into one single line.
Be careful not to delete any characters while doing that. Final output should like the following window.

4. Save the file and quit the text editor. Assign rw permissions only for the owner.
chmod 600 ~/.ssh/authorized_keys

5. Now we have configured SSH server, its time to test our setup.
Testing
On the Client system (Windows), open Putty, enter the ip address details of the remote system. Now from the left navigation, select Connection -> Data. Enter vidyadhar as Auto-login username on the right panel.

Again from the left navigation menu, scroll down and select Connection -> SSH -> Auth. Enter the path of the saved private key file, In our case C:\vidyadhar\192.168.1.2.ppk. Leave other defaults as such and press open button.

Now the putty connects to the remote SSH server and there won’t be any password prompt here after.
