- Create a new user: Useradd hadoop
- Set Password: Passwd hadoop,Enter your desired password, and then su hadoop switches to the user.
- Modify host name: Vim/etc/sysconfig/Network: add the hostname master. After logging out of the system, you can see that the modification is successful.
- Modify the hosts file: Vim/etc/hosts 192.168.56.101 master 192.168.56.102 slave1
- SSH Login-free, View SSH:
-
[[Email protected] ~] $ Rpm-Qa | grep SSH Openssh-server-5.3p1-94.el6.x86_64 Libssh2-1.4.2-1.el6.x86_64 Openssh-clients-5.3p1-94.el6.x86_64 Openssh-5.3p1-94.el6.x86_64 Openssh-askpass-5.3p1-94.el6.x86_64 |
I have installed all of them. If not, use Yum Install SSH (which is missing)
- Modify/etc/ssh/sshd_config
Rsaauthentication yespubkeyauthentication yesauthorizedkeysfile. Ssh/authorized_keys |
Enable these three lines, and then restart service sshd restart
- Configure password-free logon now
[[Email protected] ~] $ CD/home/hadoop/ [[Email protected] ~] $ Ssh-keygen-t rsa one-way carriage return [[email protected] ~] $ Cd. Ssh/ [[Email protected]. Ssh] $ CP id_rsa.pub authorized_keys [[Email protected]. Ssh] $ chmod 600 authorized_keys Copy authorized_keys to another machine without password [[email protected] Master ~] $ SCP authorized_keys [email protected]:/home/hadoop/. Ssh must pass the root permission; otherwise, an error occurs. |
- Set. Ssh Directory Permissions
Chmod 700-R. SSH if you want to log on to every machine without a password, add the key generated by each machine sub-account to the file (this is executed on the controlled machine Sub-Account) Cat id_rsa.pub>. SSH/authorized_keys
|
- Now you can log on to slave1 from the master without logon. If you want to log on to the master from slave1, you also need to execute
SCP authorized_keys [email protected] 1:/home/hadoop/. Ssh/after the file is copied to the master, run: CAT id_rsa.pub>. Ssh/authorized_keys on the master. In this way, you can log on from the master to slave1, or from slave1 to the master without a password. |
- For example, after the configuration is successful, the interface is as follows::
[[Email protected] ~] $ Clear [[Email protected] ~] $ SSH slave1 Last login: Mon Nov 3 13:33:02 2014 from 192.168.56.101 [[Email protected] ~] $ SSH master Last login: Mon Nov 3 13:33:06 2014 from 192.168.56.102 [[Email protected] ~] $ |
Centos6.5 configure SSH password-free Login