How does the Xshell connection remember the user key file

scene description

There are two commonly used methods for server ssh login:

  • Method 1: User password authentication, enter the user name and password when logging in.
  • Method 2: Public Key User Authentication (Public Key User Authentication), provide user name + private key when logging in. The public key needs to be stored in the user's file on the server ~/.ssh/authorized_keys. If it is the root user, it is stored in /root/.ssh/authorized_keysthe file, and if it is other users, it is stored in /home/username/.ssh/authorized_keysthe file.

Companies with strict management will follow method 2 to set up server login, and method 1 is prohibited.

Because the password of method 1 is easy to leak, it is easy for everyone to share the same user name and password. Compared with method 2, the security is not so good.

Users who log in to the server through public key authentication for the first time may find it inconvenient to select a private key file every time they log in to the server.

Then how to let Xshell remember your private key, without having to manually select the private key file every time you log in to the server?

solution

  • Step 1: In the login prompt box, in the column of user secret key, select Browse->User secret key

  • Step 2: In the pop-up window of the user key, choose to import the key.

  • Step 3: Select the imported key and click OK.

  • Step 4: If a password is set when the key is generated, enter the password in the password box below the user key box.

    If there is no password set for the secret key, there is no need to enter the password. Finally, select Remember Password and click OK. (This remember password is the password of the remembered user key)

Summarize

Public key authentication is a more secure method than username/password login, and it is also convenient to track which user performed the operation when the server behaves abnormally.

recommended reading

open source address

Articles and sample codes are open-sourced on GitHub: Essential Operation and Maintenance Manual for Development .

Official account: advanced coding. Follow the official account to get the latest development and operation and maintenance skill points.

Personal website: Jincheng's Blog .

Zhihu: Wuji .

Welfare

I have compiled a gift pack of back-end development learning materials for you, including programming language entry to advanced knowledge (Go, C++, Python), back-end development technology stack, interview questions, etc.

Follow the official account "coding advanced", send a message to backend to receive a data package, this data will be updated from time to time, and add data that I think is valuable.

Send a message " Join the group ", communicate and learn with peers, and answer questions.

Guess you like

Origin blog.csdn.net/perfumekristy/article/details/128172736