Ssh-keygen generates a public and private key pair.
Ssh-copy-id The local public key is copied to the remote machine's Authorized_keys file, Ssh-copy-id can also let you have to the remote machine/home/username/.ssh and ~/.ssh/authorized_ The right to the keys.
Operation Record:
1) First step: Use Ssh-keygen on the local machine to generate the public key private key pair
#ssh-keygen-t RSA [All-way default carriage return]
This will generate the public and private key files in the. SSH directory in the current user's home directory: Id_rsa.pub, Id_rsa
2) Copy the public key to the remote machine with Ssh-copy-id
#ssh-copy-id-i/root/.ssh/id_rsa.pub [email protected] [copy the local public key to the remote machine, such as B machine]
Note: Ssh-copy-id writes key to the ~/. Ssh/authorized_key. File in the remote machine.
3) In this way, the machine login to the above remote machine (b machine) do not enter the password
#ssh [email protected]
Implementing SSH without password login: using Ssh-keygen and Ssh-copy-id