If SSH service is not installed, install by command:
sudo apt-get install SSH
To start the SSH service:
Service sshd Restart
ssh Password-free login principle is as follows
If a machine wants to access B machine via SSH without password, it needs to generate a pair of secret keys (public key + private key) on a machine and then copy the public key to the B machine;
When a machine is linked to the B machine via SSH, B machine will generate a random number, and use a machine's public key (through the previous copy, B machine has a copy of a machine public key) to encrypt the random number, and the encrypted "ciphertext" back to a machine;
A machine received the ciphertext, with its own private key to decrypt, the decryption after the "clear" (in fact, that random number) and then back to B machine;
B Machine received a machine sent over the "clear", with its own copy of the confirmation, when the confirmation pass allows a machine to link itself;
(The whole process is a public key authentication process, without password input, from the SSH protocol point of view, A is the client, B is the server side)
So, the key question is how to generate the key pair on a machine and send the public key to the B machine.
Configuration steps
First: Generate secret key pairs on a machine
SSH-KEYGEN-T RSA
Then there will be two files in the/root/.ssh/directory: Id_rsa and Id_rsa.pub
Second: Copy the id_rsa.pub to a file named Authorized_keys in this catalogue.
Cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
Third: Set up the. SSH directory and Authorized_keys file permissions separately
chmod ~/.ssh
chmod ~/.ssh/authorized_keys
The above operation completes, then completes the a machine to the native (a machine) the SSH password login, now wants to make a no password SSH login B,
Four: in the B-machine new. SSH directory with Authorized_keys file, and the same third step modify permissions
V: Copy the id_rsa.pub from the A machine to the B machine through the SCP and append to the Authorized_keys file of the B machine
(Complete the above steps, complete a machine to B machine without password SSH login)
When you are in a cluster of multiple machines, and we want SSH password-free logons every 22, you can plan the build process above:
First: Generate the secret key pair on all machines;
Second: iterations to copy their own id_rsa.pub to other machines, and append to the Authorized_keys file;