How to automatically log on to the ssh server without entering a password in Linux
When you log on to the ssh server using OpenSSH in linux, you are prompted to enter the password each time. When you use the vim netrw plug-in to edit a remote file, you need to enter the password each time you modify the file and save it. This is very troublesome. I checked the help document of netrw and found that I have introduced how to automatically log on to the ssh server:
1. Create a public/private key pair (on the client machine)
Ssh-keygen-t rsa (saving the file in ~ /. Ssh/id_rsa as prompted)
After you enter the preceding command (do not enter it in parentheses), you will be prompted to enter passphrase and press ENTER twice without passphrase.
In this case, you can see ~ /. Two files generated under the ssh Directory: id_rsa and id_rsa.pub.
Tip: If the id_rsa key file already exists in the. ssh directory, you can change it to another name, but you still need to put it in the. ssh directory.
2. Create a. ssh directory on the ssh server
Log on to the ssh server and enter the following command.
Cdmkdir-p. sshchmodmod 0700. ssh
3. Create an authenticated keys on the server
Enter the following command on the client machine (not on the server)
Ssh serverhostname cat'> ''~ /. Ssh/authorized_keys '<~ /. Ssh/id_rsa.pub
Enter the logon password.
4. OK. As a result, try logging on to the server using ssh serverhostname. You do not need to enter the password.