Often, instead of the standard username and password, you would like to use a private SSH [ How to connect to server using PuTTY ] key to connect to remote host via SSH. In this short post, I will show you how to connect to your server instance using SSH key and PuTTY on Windows. PuTTY is open source tool which helps you many times.
Table of Contents
PuTTY is a free and open-source terminal emulator and SSH client for Windows and Unix-like operating systems. It is developed by Simon Tatham and is widely used for connecting to remote servers and transferring files over SSH, Telnet, and other network protocols.
PuTTY is a lightweight and easy-to-use application that provides a simple interface for connecting to servers and transferring files. It supports various authentication methods, including password, public key, and keyboard-interactive, and it allows you to save and reuse connection settings for different servers.
To use PuTTY, you will need to download and install the application on your local machine. Once installed, you can use the PuTTY GUI to connect to a remote server. You can enter the hostname or IP address of the server, select the protocol (SSH, Telnet, etc.), and enter your login credentials. Once connected, you can use the terminal window to run commands and transfer files on the remote server.
PuTTY is a popular and widely used tool for connecting to and managing remote servers, and it is supported by a large and active community of users and developers. It is available for Windows, Linux, and MacOS, and it is licensed under the MIT License.
PuTTY Key Generator (PuTTYgen)
PuTTYgen is a tool included with the PuTTY package that allows you to generate public and private keys for use with PuTTY and other SSH clients. It is a graphical tool that provides a simple interface for generating and managing keys, and it supports various key types, including RSA, DSA, and ECDSA.
PuTTYgen is a useful tool for generating and managing SSH keys, and it is widely used in combination with PuTTY and other SSH clients. It is available for Windows and Unix-like operating systems, and it is licensed under the MIT License.
SSH Private And Public Keys
SSH (Secure Shell) is a network protocol that allows you to securely connect to and manage remote servers over an unsecured network. It uses public-key cryptography to authenticate the client and server and to encrypt the communication between them.
To use SSH with public-key authentication, you will need to generate a pair of SSH keys: a private key and a public key. The private key is kept on the client machine and is used to authenticate the client to the server. The public key is stored on the server and is used to verify the authenticity of the client.
To generate a new pair of SSH keys, you can use a tool such as
ssh-keygen on Unix-like systems or PuTTYgen on Windows. The key generation process will generate both a private key and a public key. The private key should be kept secret and should not be shared with anyone. The public key can be shared freely and is used to verify the authenticity of the client.
A PuTTY session is a saved configuration for connecting to a remote server using the PuTTY terminal emulator. When you create a new PuTTY session, you can specify the hostname or IP address of the server, the protocol (SSH, Telnet, etc.), and the login credentials. You can also configure other settings, such as the terminal type, the window size, and the connection options.
To connect to a saved session, you can select the session from the
Saved Sessions list and click the
Load button. This will load the session settings and allow you to connect to the server by clicking the
To use SSH keys for authentication, you will need to do the following:
- Generate a new pair of SSH keys.
- Copy the public key to the server. You can do this using the
ssh-copy-idcommand or by manually copying the key to the
authorized_keysfile on the server.
- Connect to the server using the private key. You can do this using the
sshcommand with the
-ioption to specify the path to the private key file.
Using SSH keys for authentication is more secure than using a password, as it allows you to use strong, unique keys for each server and eliminates the need to store and transmit passwords over the network. It is widely used in combination with SSH clients such as PuTTY and OpenSSH.
First, at the session window, enter your host name or IP address and select SSH as Connection type.
If you want, you can save your session – enter you session name at the Saved Session field and click Save. Without it, you will have to enter your configuration details every time.
Add Private Key File -> How To Connect Linux Server Using Putty
Next, download your key to your local computer and go to Connection -> SSH ->Auth at the category tab. You should see Private key file for authentication like on the screen below:
How To Connect To Linux Server From Windows Using PuTTY?
Click Browse… and select private key file from your computer.
Next, go to session tab and click Save to remember you private key file location and that’s it!
Putty Key Generator
To generate private and public keys using PuTTY Key Generator you need to open PuTTYGen which was installed with PuTTY. Search for it in the start menu by typing: PuTTYGen. Then you have to select the Key Type to Generate like:
- RSA (Rivest–Shamir–Adleman) – is a public-key cryptography algorithm that is widely used for secure data transmission and digital signatures. It is named after its inventors, Ronald Rivest, Adi Shamir, and Leonard Adleman, who developed the algorithm in the 1970s.
- DSA (Digital Signature Algorithm) – is a public-key cryptography algorithm that is used for digital signatures and key exchange. It was developed by the National Institute of Standards and Technology (NIST) in the 1990s and is based on the difficulty of computing discrete logarithms.
- ECDSA (Elliptic Curve Digital Signature Algorithm) – is a variant of the DSA algorithm that uses elliptic curve cryptography to provide stronger security with smaller key sizes. It is widely used in SSL/TLS certificates, Bitcoin, and other applications.
- EC25519 is a specific curve used in the ECDSA algorithm. It is a Montgomery curve that provides good security with small key sizes and fast performance.
- SSH-1 (RSA) – is an obsolete version of the SSH (Secure Shell) protocol that was used in the 1990s. It used the RSA algorithm for key exchange and authentication, and it has since been superseded by newer versions of the SSH protocol.
These algorithms are used in various contexts to provide secure communication, data encryption, and digital signatures. They are supported by a range of cryptographic libraries and tools and are widely used in applications such as SSL/TLS certificates, SSH, and Bitcoin.
In our case we will choose the first one – RSA. Then click Generate button and you will have to move your mouse to get input for PuTTY Key Generator. This is such a trick, because no one will be able to repeat the moves you made, so the probability of generating the same two pairs of keys is practically equal to 0.
After generating the key, save the private and public key on your hard drive. For security, you can assign a password to the private key. When you give a password, then each time you try to use this key during the connection, you will be asked for the password, which gives you another layer of security. I come here when someone could steal your private key file, it will be a problem because you will also need to know the password.
After reviewing this post, you should be able to connect to any server with a private-public key pair using SSH. In addition, we learned how to generate a private and public key when we do not have them yet.
Could You Please Share This Post? I appreciate It And Thank YOU! :) Have A Nice Day!
How do I connect to a Linux server using PuTTY?
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?