Password-free Login with Ssh-keygen

Source: Internet
Author: User

Requirements: When you need to manage more than one server, back and forth to switch the host when entering the password is a very troublesome thing, this time you can use Ssh-keygen password-free login.


Simple machine Process: If a requires password-free login b, use Ssh-keygen to generate the corresponding key pair on a, and then use Ssh-copy-id to send the generated public key to remote host a.


Specific operation

A on the execution:

[Email protected] ~]# Ssh-keygen #生成相应密钥对, if the first use, there will be a few pauses, directly hit enter to keep the default is OK [[email protected] ~]# Ssh-copy-id [email Protected] #执行此命令过后, enter the root password of the remote Host B, the Ssh-copy-id tool can send the public key in the past, is configured with the appropriate permissions (these are not the tube, keep the default is good) [[email protected] ~]# SSH [ Email protected]last login:fri 4 10:39:53 from 117.174.247.158[[email protected]_116_108_centos ~]# #配置完成后, Direct SS H Remote Host B can complete password-free login


Tip: If you have previously configured a key login, the following error will occur when you configure it again:

Now try logging to the machine, with "ssh" [email protected] ' ", and check in:. Ssh/authorized_keysto Make sure we haven ' t added extra keys, you weren ' t expecting.

Error translation:

Now try logging into the machine, using "ssh" [email protected] ', and check in:


. Ssh/authorized_keys


To make sure we didn't add extra keys that you didn't expect.


Cause of Error:

Prior to the corresponding configuration, once again configured, when the execution of Ssh-copy-id [email protected], and enter the corresponding root password, in fact, has been configured successfully, here is just prompt us, try to SSH login to the following remote host, Make sure that no additional keys are added (the host detects a similar key in the corresponding file because of a similar operation before). So, at this point we just have to try to ssh into the remote host on the line.

[[email protected] ~]# ssh [email protected]last login:fri Nov 4 10:39:53 from 117.174.247.158

can be password-free, indicating that the configuration is not a problem.

Password-free Login with Ssh-keygen

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.