Linux Basic Command Three

Source: Internet
Author: User

One, two servers password-free login: 1. Generate Key

Ssh-keygen Command Manual, the "man Ssh-keygen" command to view the instructions:

Create a pair of keys, including the public key and the private key, from the command "ssh-keygen-t RSA" , which will generate a ". SSH" folder at the user's root directory

Go to ". SSH" To view the generated files

Authorized_keys: The public key that stores the remote password-free login, which records the public key of multiple machines mainly through this file.

ID_RSA: Generated private key file

Id_rsa.pub: Generated Public key file

Know_hosts: List of known host public keys

If you want the SSH public key to take effect, at least two of the following conditions will be met:

1). The SSH directory must have permissions of 700

2). The. ssh/authorized_keys file permission must be 600

The following methods are commonly used:

   2.1 By way of Ssh-copy-id

Command: Ssh-copy-id-i ~/.ssh/id_rsa.put <romte_ip>

Example:

[email protected]. ssh]# ssh-copy-id-i ~/.ssh/id_rsa.pub 132.232.138.29

[email protected]. ssh]# ssh [email protected] 132.232.138.29 connect directly to another server .

    2.2 Writing content to each other's files via SCP

Command: scp-p ~/.ssh/id_rsa.pub [Email Protected]<remote_ip>:/root/.ssh/authorized_keys

SCP: that is, Ssh-copy-id

Example:

1. scp-p ~/.ssh/id_rsa.pub [email protected]:/root/.ssh/authorized_keys

2. SSH [email protected] Connect directly to another server.

Original Reference Address: http://www.cnblogs.com/LuisYang/archive/2016/10/12/5952871.html

        

Linux Basic Command Three

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.