SSH password-free login between Linux

Source: Internet
Author: User

First, generate a public private key pair
$ ssh-keygen -t rsa -p  ' Generating public/private rsa key pair. enter file in which to save the key  (/ROOT/.SSH/ID_RSA):  Your  identification has been saved in /root/.ssh/id_rsa. your public key has been saved in /root/.ssh/id_rsa.pub.the key  Fingerprint is:88:64:ed:a1:a7:a2:c0:b4:ee:77:38:2f:c7:39:c6:c1 [email protected]the key ' s  RANDOMART IMAGE IS:+--[ RSA 2048]----+|                  | |      .           | |     o o          | |    o + o         | |  .  + + s        | | o .  e           | |. o. = o          | | o. * o           | | Oo. b.           |+-----------------+ -p phrase    Provide old passphrase.  this refers to the password that uses the private key  -t type      specify type of key to create.  This is the type of public private key created  $ ll .ssh/total 8 -RW-------.  1 root root 1675 sep  6 04:12 id_rsa-rw-r--r--.   1 root root  394 sep  6 04:12 id_rsa.pub
Second, copy the public key to password-free login machine
$ ssh-copy-id [Email protected]the authenticity of host ' 172.17.5.46 (172.17.5.46) ' can ' t be established. RSA Key fingerprint is 8e:ac:89:5d:10:be:e7:d8:a2:34:0b:bf:70:cd:ce:33.are your sure you want to continue connecting (yes/n o)? yeswarning:permanently added ' 172.17.5.46 ' (RSA) to the list of known hosts. [email protected] ' s Password:now try logging into the machine, with "ssh" [email protected] ' ", and check in:. Ssh/author Ized_keysto Make sure we haven ' t added extra keys and you weren ' t expecting.

Login-Free machine:

$ LL. ssh/total 4-RW-------. 1 root root 394 Sep 6 04:16 Authorized_keys
Third, testing
# SSH 172.17.5.46Last Login:sun Sep 6 04:06:43 from 172.17.5.45[[email protected] ~]#

Successful password-free login.

Iv. Conclusion

    1. Password-free login does not have to enter the password every time, convenient many;

    2. Rsync can also use SSH authentication to transfer files between Linux servers without password;

    3. It is best not to configure password-free login for root user


SSH password-free login between Linux

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.