Use of Polysh
Polysh is an interactive command that can be processed in batches to the server, which is ideal for applications where interactive processing is required, such as changing the root password. Use the Polysh command to quickly complete bulk modification of the server root password.
Polysh is a tool written in Python that can be installed directly using PIP
Pip install polysh==0.4 #python2.7 in the environment using version 0.4
The parameters of the Polysh are as follows:
Where--host-file is used to specify a list of IP addresses. --user used to specify the user to telnet to the server,--SSH is similar to the normal SSH command, where the port number and private key need to be specified
Before using Polysh, you need to copy the key to the remote server, as follows:
Ssh-keygen #生成密钥ssh-copy-id-i ~/.ssh/id_rsa.pub remote-host #将公钥上传给远程服务器
Then use Polysh to change the password in bulk
Polysh--ssh= ' exec ssh-p 22-i ~/.ssh/id_rsa '--user=root--hosts-file=host #host文件内容为定义好的主机地址
After the completion key is distributed to the remote server, it is possible to use Ploysh for interactive bulk Change password
Ploysh Bulk modification of Linux host passwords