Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure password-free login for hadoop2.5.2

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to configure hadoop2.5.2 password-free login, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Configure login-free

Create or modify key directory permissions

Assuming that the IP of this machine is "192.168.1.100", the steps to configure login-free are as follows:

1. Log in to each server as the hadoop user.

two。 Execute the following command to modify the ".ssh directory" permission.

Chmod 755 ~. Ssh

Note: if the ".ssh" directory does not exist, execute the mkdir ~ / .ssh command in the / home/hadoop directory to create it.

A) if ".ssh directory" does not exist, create ".ssh directory".

Mkdir / .ssh

B) modify the ".ssh directory" permission.

Chmod 755 ~. Ssh

Create public and private keys (this operation will not proceed to the next step until all servers have completed)

1. Log in to the machine as the hadoop user (assuming that the local IP is "192.168.1.100").

two。 Execute the following command to go to the ".ssh" directory.

Cd / home/hadoop/.ssh

3. After executing the following command, press the "Enter" key until the public key is generated if prompted.

Ssh-keygen-t rsa

If after the public key and private key are created (at the bottom of the figure above), the prompted user name hadoop@ is not followed by a local alias (such as master), indicating that the host name needs to be reconfigured, then remember to restart, and then delete the public key and private key under the / .private directory and regenerate until the generated key suffix is a local alias.

Then do the following configuration on the Master node to append the id_rsa.pub to the authorized key.

Cat ~ / .ssh/id_rsa.pub > > ~ / .ssh/authorized_keys

There are two things that need to be done before verification. The first thing is to modify the file "authorized_keys" permission (the permission setting is very important, because unsafe security settings will prevent you from using the RSA feature), and the other thing is to set the content of "/ etc/ssh/sshd_config" with root users. Make it valid to log in without a password.

1) modify the file "authorized_keys"

Chmod 600 ~ / .ssh/authorized_keys

2) set SSH configuration

Log in to the server with the root user to modify the following contents of the SSH configuration file "/ etc/ssh/sshd_config".

Vi / etc/ssh/sshd_config

RSAAuthentication yes # enable RSA authentication

PubkeyAuthentication yes # enables public and private key pairing authentication

AuthorizedKeysFile .ssh / authorized_keys # public key file path (same as the file generated above)

Remember to restart the SSH service after setting up to make the previous setting valid.

Service sshd restart

Log out of root and use the hadoop normal user to verify whether it is successful.

Ssh localhost (hostname) [yellow part is variable]

From the picture above, we know that the password-free login level has been set up, and the next thing to do is to copy the public key to all Slave machines.

(3) copy the public key to the server (the server to log in to slave)

Copy the public key using the following command format:

Scp ~ / .ssh/id_rsa.pub remote user name @ remote server IP:~/

For example:

Scp / .ssh/id_rsa.pub hadoop@192.168.1.101:~/

The above command is to copy the file "id_rsa.pub" to the user "/ home/hadoop/" with server IP of "192.168.1.101" as "hadoop".

Here is the configuration for the node with the Slave01.Hadoop whose IP is "192.168.1.101".

1) copy the public key on Master.Hadoop to Slave1.Hadoop

From the picture above, we know that the file "id_rsa.pub" has been passed, because no password connection has been established, so when connecting, we still have to prompt for the password of the Slave01.Hadoop server user hadoop. To make sure the file has been passed, log in to the Slave1.Hadoop:192.168.1.101 server with SecureCRT to see if the file exists under "/ home/hadoop/".

We know from above that we have successfully copied the public key.

Append to the license file "authorized_keys" >

1) append the public key of Master.Hadoop to Slave1.Hadoop 's authorization file "authorized_keys". Append and modify the "authorized_keys" file permissions using the following command:

Cat ~ / id_rsa.pub > > ~ / .ssh/authorized_keys

Chmod 600 ~ / .ssh/authorized_keys

2) modify "/ etc/ssh/sshd_config" with root user

For specific steps, please see "set SSH configuration" in Master.Hadoop, which is divided into two steps: the first is to modify the configuration file; the second is to restart the SSH service. [similarly 2) set SSH configuration]

3) use Master.Hadoop to log in to Slave01.Hadoop without a password using SSH

When the previous steps are set up, you can log in without a password for SSH using the following command format.

Ssh slave01 [remote server IP]

From the figure above, we have three main places, the first is the SSH password-less login command, and the second and third is that the machine name after "@" before and after login has changed from "master" to "slave01", which shows that we have successfully implemented SSH password-less login.

Finally, remember to delete the id_rsa.pub file in the "/ home/hadoop/" directory.

Rm-r ~ / id_rsa.pub

So far, you have implemented a password-less login from "master.Hadoop" to "slave01.Hadoop" SSH. The following is to repeat the above steps to configure the remaining two (slave02.Hadoop and slave03.Hadoop) Slave servers. In this way, we have completed configuring Master to log in to all Slave servers without a password.

Configure all Slave password-less login Master

The same principle as master password-less login for all slave, is to append the public key of slave to "authorized_keys" under the ".ssh" folder of master, remember to append (> >).

In order to illustrate the situation, we will now take the "slave01.Hadoop" password-less login "master.Hadoop" as an example to consolidate the previous knowledge, and the remaining "Slave2.Hadoop" and "Slave3.Hadoop" can be carried out according to this example.

First create "slave01.Hadoop" its own public and private keys, and append its own public key to the "authorized_keys" file. The commands used are as follows:

Ssh-keygen-t rsa

Cat ~ / .ssh/id_rsa.pub > > ~ / .ssh/authorized_keys

The above is all the contents of the article "how to configure password-free login in hadoop2.5.2". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report