Hadoop--centos constructs SSH no password login considerations

Source: Internet
Author: User

Reprint Please specify source: http://blog.csdn.net/l1028386804/article/details/46388809

Prerequisite configuration: Use the root login to change the configuration file:/etc/ssh/sshd_config. Remove the gaze from the three rows, such as the following

Then restart the SSH service: service sshd restart. Finally quit Root and all of the following are done under Hadoop users .

Host information such as the following:

For example, the currently logged on user is Hadoop and the hostname is slave.hadoop. The network with the Master.hadoop host is unobstructed.

The RSA checksum is not currently configured. SSH connection to the host is required to input password. For example, the following:

For example, after running SSH Master.hadoop, it will stay on the next line waiting for the user to enter the login password of the Master.hadoop host Hadoop users.

To prevent this from happening, do the following, for example, to have the host authenticate itself when SSH connects and log on.

First, run the command ssh-keygen-t DSA to generate the key pair. For example, the following:

For example, the key file is created by default in the hidden folder under the home folder/home/hadoop. ssh. ID_DSA and id_dsa.pubrespectively, the latter being the public key. For example, with:

Based on the value of the Authorizedkeysfile entry in profile/etc/ssh/sshd_config:. Ssh/authorized_keys. The public key needs to be imported into the file to enable validation, such as the following:

It's just a step away from success.

The new CentOS Default file permissions are:-rw-rw-r--, which means that both yourself and the group user are able to rewrite the file, which is not considered safe enough. For example, because the Authorized_keys file does not already exist on my console, the default permission for the file is-rw-rw-r--still not secure because the redirect output creates a new file. You need to remove the W permission from the group. You can use the command:chmod 644 Authorized_keys. Online information, are directly chmod authorized_keys. That is, groups and other users do not have access to the contents of the file, of course, this is the safest, but the system only requires that all other than their own can not modify the file can be.

For example, Slave.hadoop can already log on to the machine using SSH without password. So how do you get it to log into the Master.hadoop host without password? Of course it is distributing the contents of the public key file Id_dsa.pub to the Master.hadoop host. For example, with:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbdewmjgzody4mdq=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">

For example, run the command cat ~/.ssh/id_dsa.pub | ssh [email protected] ' cat->> ~/.ssh/authorized_keys ', and enter the Master.hadoop host's Hadoop user login password, you can send the public key to Master.hadoop and append to its Authorized_keys file.

Such as. The Slave.hadoop host is already able to use SSH no password login host Master.hadoop that.

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

Hadoop--centos constructs SSH no password login considerations

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.