The ultimate explanation of ssh password-less login and the ultimate explanation of ssh password-less Login

Source: Internet
Author: User

The ultimate explanation of ssh password-less login and the ultimate explanation of ssh password-less Login

Directory:/root/. ssh

 

The configuration involves four shells.

 

1. One operation per machine

Ssh-keygen-t rsa

Generate an ssh key. The generated file is as follows:

Id_rsa

Id_rsa.pub

. Pub is the public key, and No. pub is the private key.

 

2. One operation per machine

Cp id_rsa.pub authorized_keys

 

Authorized_keys Error

 

3. copy and distribute each machine.

Scp id_rsa.pub hadoop262:/root/. ssh/hadoop261.pub

 

Scp for remote copy

Copy the Local Public Key to the/root/. ssh directory of hadoop262. The new file name is hadoop261.pub.

 

4. Add the public key of another machine to the local machine and you will not be able to enter the password.

Cat hadoop261.pub> authorized_keys

 

In addition to the id_rsa.pub file, all xxxxx. pub machines are added;

 

Note:

Host ing of/etc/hosts, ing to the local machine, hostname of the Local Machine in/etc/sysconfig/network, as long as there is no conflict, generally there will be no problem, if you are afraid, you will be confused and in conflict.

 

My shell script:

 

/Etc/hosts --> Configuration

# Master hadoop localhost

192.168.121.218 hadoop261

# Salve1 hadoop

192.168.121.228 hadoop262

# Salve2 hadoop

192.168.121.238 hadoop263

127.0.0.1 localhostlocalhost. localdomain hadoop261

 

/Etc/sysconfig/network--> Configuration

NETWORKING = yes

HOSTNAME =Hadoop261

GATEWAY = 192.168.121.1

 

 


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.