For a more secure and convenient login to the Linux server, you can log in using the private key, which is more convenient and more secure.
Generate key
With Xshell you can easily generate and manage private keys, click on the Tools menu and choose the New User Key Generation Wizard:
Click Next directly
Enter a name and password, then click Next
Save the public key for backup, and the public key needs to be uploaded to the Linux server.
Upload Public key
Log in with your username and password and enter the command
CD. SSH
Save the public key to the. SSH directory
The upload succeeds as shown in:
Import Public key
After the public key is uploaded, the public key needs to be imported
Cat Remoteppk.pub >> Authorized_keys
After the successful import, you can delete the remoteppk.pub file, of course, do not delete also no problem. The permission to modify the Authorized_keys file is 600, the default is 600, to prevent not, to reset it:
*
Log on with a public key
Open user authentication, select the login method as public key, and select the key you just created, enter the password.
Cancel Password Login
Do so much, the purpose is to cancel password login, in the attempt to use the public key can log in after the normal, you can cancel the password login, delete the user's password directly
passwd-d Root
Original address: https://www.zkea.net/codesnippet/detail/post-75
Linux uses private key (public key) login-password-free login