Password-free logon settings for ssh

Source: Internet
Author: User
Two Linux machines log on to each other using ssh without A password. assume that user user1. On HostA, run ssh-keygen to generate the private key id_rsa and public key id_rsa.pub as user1, and then run the command ssh-copy-iduser1 @ HostB to copy the public key to HostB, enter the user1 password on the HostB, and then log on to the HostBssh with no password

Two Linux machines log on to each other using ssh without A password. assume that user1.

Run the command in user1 on Host.

 
 
  1. ssh-keygen

Generate the private key id_rsa and public key id_rsa.pub, and then execute the command

 
 
  1. ssh-copy-id user1@HostB

Copy the public key to Host B, and enter the user1 password on Host B, then Host A and Host B ssh password-free login

Scp the private key on Host A to Host B

 
 
  1. scp ~/.ssh/id_rsa user1@HostB:~/.ssh/

Change the public key id_rsa.pub on Host A to authorized_keys.

 
 
  1. mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys

At this point, the password-free logon from Host B to Host A ssh is also required.


Related Article

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.