How to bulk log in to remote host and configure "Go"

Source: Internet
Author: User

This article is mainly about how to bulk log in to the remote host and configuration, which is done before the deployment of parallel processing tools or cluster management tools.

———————————— First Landing ——————————————

The problem that needs to be solved for first landing is:

1, trust the remote host public key problem, namely key_word:yes/no?

2, then the remote host's password, Key_word:password:

During the automated deployment process, interactive and password-free logins are required.

1, use expect to write a non-interactive landing script (for TELNET,SSH,FTP, etc.), and then use the shell call expect script for batch processing

2, use Ssh-keygen-h to create a local public key, and then pass the public key to the remote host, you can password-free login

Therefore, for the first time landing, and the local management host's public key is transferred to the remote host, you can write a script to implement

———————————— First login, create/root/.ssh ——————————————

1. Create a script that logs into a single remote host:

Ssh_login.exp, the contents are as follows

This script is primarily for the first time without interactive login to the remote host and then create the/ROOT/.SSH directory

2, create the batch landing script, the content is as follows:

3. Run the script./, which can be created in the remote host list/root/.ssh

————————— Copy the local/root/.ssh/authorizd_keys to the remote host ——————————

1. Create a script that copies a single file

Scp_authorized_keys.exp, the contents are as follows

2. Create a script for bulk copy files

./, the contents are as follows

———————————————————— Verify Login ————————————————

After copying the local authorized_keys to the remote host, the local host can login to the remote host without password.

After you configure the trust relationship, you can also deploy the cluster management tools on the local management host to centralize the virtual cluster management.

such as installing PSSH,C3, etc.

———————————————— configuration modification of the remote host ————————————————

According to the content of these two blog posts, there is basically no password to login to the remote host. Based on this, you can deploy the cluster management tool or write a parallel command execution script, the remote host configuration system, or unified modification

For example:

1. Modify the hostname according to the IP address of different host

2. Copy the following files to the remote host:

/etc/hosts;/etc/selinux/config;/etc/ssh/sshd_config;/etc/ssh/ssh_config;/etc/pam.d/sshd;/etc/secutity/ ACCESS.CONF, etc.

Yum-y Install Pssh

Pssh-i-H hostfile/etc/hosts


For points with fewer than 10 cluster nodes, you can actually configure them manually. But for a large number of clusters, scripting can bring a lot of convenience. At the same time, the formal environment of the equipment has out-of-band management interface and management Maintenance network, more convenient to use.

How to bulk log in to remote host and configure "Go"

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: 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.