How to automatically log on to the ssh server without entering a password in Linux

Source: Internet
Author: User
Tags ssh server

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.