Linux SSH multiple machines without password communication

Source: Internet
Author: User

(This is the case for root user)

First, 3 machines, we take two workers, a boss for example

192.168.1.1 boss

192.168.1.2 Worker1

192.168.1.3 Worker2

1, Vim/etc/sysconfig/network

Modified hostname to BOSS,WORKER1 on 3 machines respectively, Worker2

2.vim/etc/hosts set the following configuration in 3 machines respectively.

192.168.1.1 boss

192.168.1.2 Worker1

192.168.1.3 Worker2

3. Execute ssh-keygent-t RSA generate encryption Key

Cd/root/.ssh and view LS

The public key id_rsa.pub is now generated

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

(Ps:authorized_keys is used to save the public key content of all users who are allowed to log on to the ssh client as the current user)

Verify that a single machine can log on using SSH

SSH localhost

The first time will prompt

Performed separately on the worker

SCP id_rsa.pub [Email protected]:/root/.ssh/id_pub.pub.worker1

SCP id_rsa.pub [Email protected]:/root/.ssh/id_pub.pub.worker2

Then execute on the Boss node

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

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

Then the Authorized_keys SCP of the Boss node to each node

SSH worker 1 is executed at this time

There will be a login, and you are already logged into the target machine

This enables the non-cipher communication of each machine.

Linux SSH multiple machines without password communication

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.