When an administrator wants to manage dozens of hundreds or even thousands of servers, the trouble is that every time a server is connected, a single password can be exhausted. In fact, the linux Public Key can achieve password-free ssh Login Password-free settings are as follows: (1) generate a Public Private Key under the hadoop user of the masters machine: ssh-keygen-trsa-f
When an administrator wants to manage dozens of hundreds or even thousands of servers, the trouble is that every time a server is connected, a single password can be exhausted.
In fact, the linux Public Key can achieve password-free Login
The ssh password-free settings are as follows:
(1) generate a public/private key under the hadoop user of the masters machine: ssh-keygen-t rsa-f ~ /. Ssh/Id_ Rsa
Note: When ssh-keygen generates a public/private key, it will ask Enter passphrase (empty for no passphrase): # enter is skipped directly, and password will not be asked next time.
(2) copy the generated id_dsa.pub to all the remote machines to be connected in the same path: sCp~ /. Ssh/id_rsa.pub hadoop @ [ip]:/home/hadoop/. ssh
(3) Add the public keyCluster. Ssh/authoriz under all machine User DirectoriesEdIn _ keys:Cat~ /. Ssh/id_rsa.pub> ~ /. Ssh/authorized_keys
(4) During ssh connection, the private key (id_rsa) of the local computer performs authentication with the public key (authorized_keys) of the remote computer. After confirmation, you can log on directly without entering the account password, it is also safe.
NOTE: If there is no. ssh folder in the user directory, you can create it manually. Otherwise, the account ssh localhost will be automatically created once.