1. Generate Secret Key
① generate key file: ssh-keygen-t RSA, then you can always return to completion.
② this time, a. SSH directory is generated in the root directory, and you can see the generated key file by looking at the directory:
2. Install the public key
Cat Id_rsa. Pub >> authorized_keys
3, modify the permissions of the file, to ensure that you can have permission to execute
chmod Authorized_keys
chmod. SSH
4, set up SSH, open key login function
① Modify Sshd_config File: Vim/etc/ssh/sshd_config
② Open the key login function, probably in the file of 35 lines, remove the previous # number can be:
③ Restart SSH Service
Systemctl Restart sshd
5. Make Login Key file
① Copy the key file Id_rsa to the client
② open Puttygen, load in standalone actions, select our Id_rsa key
③ Click Save Private Key to save the secret key as a PPK file so that you can log in with the Putty secret key.
④ If you need a secret key for. Pub, you can use the generated id_rsa.pub directly
6. Close Password Login
① Verify that you can log on by using the secret key and then modify the Sshd_config file again: Vim/etc/ssh/sshd_config
② Disable password login:passwordauthentication No, at the bottom of the document, change Yes to no
③ Restart SSH Service
Linux ssh password-free login