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