A password-free logon script between "Linux" servers

Source: Internet
Author: User

In the actual operation of the process, often need to use the password-free login, the following script to implement the server between the password-free, as follows

For example, to achieve a server with the B, C, D server-free login, only need to write the IP address of the B, C, D server in Serverlist.txt, and then execute the following command on a server.

#!/bin/bash# Password-free login Script # Author: Blue Heart Race # Usage Instructions # in and this script sibling directory, Create a file named Serverlist.txt that will require a list of server IP addresses to be password-free to write in Serverlist.txt, with each IP address occupying one line. #特殊说明, Serverlist.txt is created in a Linux server, creating an error-prone encoding problem on windows that causes the password-free login to fail. Current=`pwd' ServerList=`Cat$current/Serverlist.txt 'mkdir-p/root/.SSHSsh-keygen-T Rsa-p"' forIpinch$serverlist Do    Echo "# $IP no password."    SSH[Email protected] $ip'mkdir-p/root/.ssh 2>/dev/null'    Cat/root/.SSH/id_rsa.pub |SSH[Email protected] $ip'cat >>/root/.ssh/authorized_keys && chmod 600/root/.ssh/authorized_keys' Done

A password-free logon script between "Linux" servers

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.