I do not know when, feel old programmer wobbly, ready to write something, to record your own youth, also don’t know where to write up, is a Java or what, think for a long time, Java is my old job, also be more mature, so I will no longer be nagging, in a recent study big data, then start with hadoop!

Hadoop must be a cluster, with many servers working together, so it is necessary to avoid secret login. Otherwise, you will have to enter your password every time, which is very troublesome

Start two virtual machines my01 and my02 locally.

I’m using a tool called Xshell, or SecureCRT, I’m using Xshell

Modify/etc/hosts

Add the IP address corresponding to my01 and my02. For convenience, the host name is usually used. Too many IP addresses are easy to remember

After saving, modify the hosts file in my02 so that you can use the host name

Straight to the point: secret free login [my01 login my02,02 login 01 the same steps],

We only need to do three steps: 1, my01 generate the secret key pair, public key and private key, 2, send the public key to my02, 3, my02 add the public key of my01 to the authorized_keys file. All right, here we go.

My01 generates the secret key pair, public key, and private key

Command: ssh-keygen -t rsa

Default RSA encryption mode, you can not write, after running, see the picture

So I’m just going to enter and I’m not going to type anything, okay

Because I’ve already generated it, there’s Overwrite, an.ssh directory in the root directory

You can view the. SSH directory on the ll-a command

Enter the CD. SSH

2. Send the public key to my02

SCP id_rsa.pub my02://home/songlj

SSH client = my02 SSH client = my02 SSH client = my02

And that sends it to the root of my02

My02 adds the public key of my01 to the authorized_keys file

Note that this is already the ll in cd. SSH on my02 server

If you don’t have authorized_keys, create a new one

touch authorized_keys

And change the permissions of this file to 600.

chmod 600 authorized_keys

Additional cat.. /id_rsa.pub >> ./authorized_keys

OK! It’s pretty much configured up here, so let’s try it out

No problem, so much more convenient, there is a SSH login process, hand drawn a picture, not very good, can explain the problem

SSH login flowchart We only need to do the first three steps. The next seven steps are internal to the system, which also belongs to the category of cryptography and will not be described here

We welcome your comments and comments