SSH client tool - PuTTY (1)

introduction

This article introduces how to download and install the SSH client tool PuTTY under Windows, how to use PuTTYgen to generate an SSH key pair, and how to remotely log in to the SSH server through PuTTY.

1. Install PuTTY

PuTTY is a commonly used SSH client tool on the Windows platform, mainly developed and maintained by Simon Tatham.

1. Download the PuTTY installation package from the PuTTY download page, such as: putty-64bit-0.78-installer.msi.

#PuTTY主页
https://www.chiark.greenend.org.uk/~sgtatham/putty/
#PuTTY下载页
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
#Simon Tatham的个人主页
https://www.chiark.greenend.org.uk/~sgtatham/

insert image description here

2. Install PuTTY.

insert image description here

insert image description here

3. After the installation is complete, you can see that there are many tools in the PuTTY software package, for example: PuTTY is an SSH client tool, which is used to connect to remote servers through SSH; PuTTYgen is used to generate SSH key pairs (SSH keys).

insert image description here

2. Generate SSH keys with PuTTYgen

1. Start PuTTYgen

insert image description here

Parameters can be modified, including the type and length of the key (Key). However, in most cases, keeping the default values ​​as shown in the image above will suffice.

2. Click the Generate button, and then follow the prompts to move the mouse freely to generate some randomness, which is used to generate Keys.

insert image description here

3. After the SSH Keys are generated, as shown in the figure below:

insert image description here

(1) The content in the text box is the generated SSH client public key, which can be pasted into the OpenSSH authorized_keysfile (note: on the remote SSH server).

(2) Key fingerprint: The fingerprint of the generated SSH Keys.

(3) Key comment: Note, can be changed.

(4) You can choose to add a password to protect the generated Keys, or not.

(5) Click Save private keythe button to save the generated private key as a .ppkfile with a suffix.

(6) Click Save public keythe button to save the generated public key as a file without a suffix. authorized_keysNote: The format of this file is different from the format of the file used for authentication in the SSH server .

(7) If you want to view the public key, click Loadthe button to load the private key file with the suffix name .ppk, and the corresponding public key will be authorized_keysdisplayed in the first text box in the above figure in the format of the file.

3. Log in to the SSH server through PuTTY

1. Start PuTTY and open the PuTTY Configuration window, as shown in the figure below:

insert image description here

2. Select Session (session) to configure the basic options of the session:

(1) Select the connection type: SSH

(2) Fill in the host name or IP address and port number of the remote server (default: 22)

3. You can give the session configuration a name (such as: ubuntu), and then click Savethe button to save the current session configuration; click Loadthe button to load the selected session configuration; click Deletethe button to delete the selected session configuration.

4. Click Openthe button to open the remote login window.

If it is the first time to log in to the remote server or the public key of the remote server has not been saved in the PuTTY cache before, the following window will pop up:

insert image description here

(1) In this window, if the public key of the remote server is displayed fingerprint, you can also click More info ...the button to view more detailed information of the public key of the remote server, and use this information to confirm whether the server is the SSH server to be connected, that is, according to The public key of the SSH server authenticates the SSH server.

(2) If you trust the remote server, you can click Acceptthe button to continue logging in, and at the same time save the server's public key in PuTTY's cache, and this window will not pop up again when you log in next time.

(3) If you click Connect Oncethe button, you can continue to log in, but the server's public key will not be saved in PuTTY's cache, and this window will pop up the next time you log in.

(4) If you do not trust the server, click Cancelthe button to cancel the login.

5. In the login window, follow the prompts to enter the user name and password on the remote server in sequence, and you can successfully log in to the remote server.

insert image description here

In this step, the SSH remote server adopts 用户名-密码this authentication method for the SSH client, and the client must enter the user name and password in sequence every time it logs in.

用户名-密码When the SSH client logs in to the SSH server, besides this authentication method, the server can also use 用户名-公钥the authentication method for the client . The method is as follows:


6. How to 用户名-公钥log in to the remote server with authentication?

(1) Use PuTTYgen to generate the SSH key pair (public key, private key) of the local client (the second part of this article).

(2) Add the client's public key to the server's file ~/.ssh/authorized_keys.

(3) Start PuTTY, open the PuTTY Configuration window, select Session, after completing the basic configuration of the session, add the private key file of the client generated with PuTTYgen to the session configuration as shown in the figure below, and then return to the option, Sessionclick Save, Save the configuration.

insert image description here

(4) Click the Open button to open the remote login window and log in to the SSH server.

In the login window, enter the user name on the remote server and press Enter. If the private key was protected with a password when PuTTYgen was used to generate the private key, you also need to enter the password of the private key.

insert image description here

Guess you like

Origin blog.csdn.net/u013819452/article/details/127837681