Premise: machines A and B are all RedHat Linux operating systems and all have user
1. Log On with the user name and run the command on machine.
Ssh-keygen-T RSA
Press enter without a password
Run this operation to generate the id_rsa and id_rsa.pub files under/home/user/. Ssh, where id_rsa.pub is the public key.
2. Perform Step 1 on machine B or manually create the/home/user/. Ssh folder. Note that the folder permission is set to 700 and id_rsa.pub is copied to machine B.
SCP id_rsa.pub :~ /. Ssh/a. id_rsa.pub
3. Copy A. id_rsa.pub copied to machine B to the authorized_keys file.
Cp a. id_rsa.pub authorized_keys
Or
Cat A. id_rsa.pub> authorized_keys
If you want to access multiple hosts, use> to add them to the authorized_keys file.
Highlights:
A sends the public key to B, not to allow B to access a, but to allow a to access B. Too domineering! That is to say, B cannot keep the public key of a in authorized_keys IN THE. Ssh folder. If it is saved, it is to give it to others for access!
If this understanding is reversed, it will always fail!
Refer:
-
Hadoop installation and configuration-ssh password-less Login
-
Add to favorites I want to contribute
-
Hadoop installation and configuration SSH Login Without Password OS: RedHat 6 hadoop two nodes, one master and one slave 192.168.0.1 master 192.168.0.2. slave 1. modify the/etc/hosts of each machine and add 192.168.0.1 master 192.168.0.2. slave 2. create hadoop useradd hadoop passwd hadoop on each machine to add permissions to hadoop users. Open the/etc/sudoers file: in root all = (all) hadoop all = (all) All is followed by hadoop users. in the/home/hadoop/directory of all machines. SSH folder mkdir/home/hadoop 4. generate a key pair ssh-keygen-t rsa on the master machine (Note: SSH and-K There is no space between eygen) one way to press Enter. Go to the. Ssh directory Cd ~ /. The id_rsa and id_rsa.pub files are generated through SSH. run CP id_rsa.pub authorized_keys 6. copy the authorized_keys file on the master to the/home/hadoop /. SCP authorized_keys slave in the ssh/file :~ /. Ssh 7. Modify the permission for modifying the. Ssh directory and authorized_keys (this must be modified, or you still need a password) sudo chmod 644 ~ /. Ssh/authorized_keys sudo chmod 700 ~ /. Ssh under normal circumstances, you can log on to this location through SSH without a password and enter SSH slave for testing.
SSH configuration password-less Login