First, in a machine generated key pair
#ssh-keygen-t rsa-f/root/.ssh/id_rsa #指证书的生成位置
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s4.51cto.com/wyfs02/m02/8a/b1/wkiom1g3o3ua3kgbaaa8csq1en4232.png-wh_500x0-wm_3-wmp_4-s_3099150748.png "title = "1.png" alt= "Wkiom1g3o3ua3kgbaaa8csq1en4232.png-wh_50"/>
Note: When the program prompts to enter passphrase, enter the carriage directly, indicating no certificate password.
The above command generates the private key certificate Id_rsa and the public key certificate id_rsa.pub, which is stored in the. SSH subdirectory of the user's home directory.
Second, view the ~/.SSH generated key file
# CD/
# CD ~/.ssh
# LL
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m00/8a/ad/wkiol1g3o4vz_q1qaaayf4zla98085.png-wh_500x0-wm_3-wmp_4-s_3197605033.png "title = "2.png" alt= "Wkiol1g3o4vz_q1qaaayf4zla98085.png-wh_50"/>
Third, using Ssh-copy-id to copy the public key to the remote machine
distribute the public key with the Ssh-copy-id-i command, by Copying the local public key to the remote machine's Authorized_keys file, Ssh-copy-id also gives you the right to the remote machine's home, ~./ssh, and ~/.ssh/authorized_keys.
#ssh-copy-id-i id_rsa.pub [email protected]
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m02/8a/ad/wkiol1g3o5jtojb5aaa-uz9bu2w124.png-wh_500x0-wm_3-wmp_4-s_2153941528.png "title = "3.png" alt= "Wkiol1g3o5jtojb5aaa-uz9bu2w124.png-wh_50"/>
Four, on another machine needs to start setting up the configuration of the server, enable key authentication login.
# Vim/etc/ssh/sshd_config
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s2.51cto.com/wyfs02/m01/8a/b1/wkiom1g3o6scmjqkaaapgzorso4628.png-wh_500x0-wm_3-wmp_4-s_3254440026.png "title = "4.png" alt= "Wkiom1g3o6scmjqkaaapgzorso4628.png-wh_50"/>
Then save it.
Five, restart the sshd service
# Service Sshd Restart
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s1.51cto.com/wyfs02/m00/8a/b1/wkiom1g3o7xhn8fkaaao7p2_uye871.png-wh_500x0-wm_3-wmp_4-s_1286351366.png "title = "5.png" alt= "Wkiom1g3o7xhn8fkaaao7p2_uye871.png-wh_50"/>
Six, the test
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s5.51cto.com/wyfs02/m00/8a/ad/wkiol1g3o8ar6n6maaalngevvtc695.png-wh_500x0-wm_3-wmp_4-s_1512585556.png "title = "6.png" alt= "Wkiol1g3o8ar6n6maaalngevvtc695.png-wh_50"/>
This article is from the "Lemon Grass Flavor" blog, please be sure to keep this source http://huyaping.blog.51cto.com/11299841/1876486
Linux SSH dual-machine trust