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