Ultimate explanation of ssh password-less Login
Directory:/root/. ssh
The configuration involves four shells.
1. One operation per machine
Ssh-keygen-t rsa
Generate an ssh key. The generated file is as follows:
Id_rsa
Id_rsa.pub
. Pub is the public key, and No. pub is the private key.
2. One operation per machine
Cp id_rsa.pub authorized_keys
Authorized_keys Error
3. copy and distribute each machine.
Scp id_rsa.pub hadoop262:/root/. ssh/hadoop261.pub
Scp for remote copy
Copy the Local Public Key to the/root/. ssh directory of hadoop262. The new file name is hadoop261.pub.
4. Add the public key of another machine to the local machine and you will not be able to enter the password.
Cat hadoop261.pub> authorized_keys
In addition to the id_rsa.pub file, all xxxxx. pub machines are added;
Note:
Host ing of/etc/hosts, ing to the local machine, hostname of the Local Machine in/etc/sysconfig/network, as long as there is no conflict, generally there will be no problem, if you are afraid, you will be confused and in conflict.
My shell script:
/Etc/hosts --> Configuration
# Master hadoop localhost
192.168.121.218 hadoop261
# Salve1 hadoop
192.168.121.228 hadoop262
# Salve2 hadoop
192.168.121.238 hadoop263
127.0.0.1 localhostlocalhost. localdomain hadoop261
/Etc/sysconfig/network--> Configuration
NETWORKING = yes
HOSTNAME =Hadoop261
GATEWAY = 192.168.121.1